Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
f2458db
feat: add 'Skip to tool menu' functionality and translations for acce…
Mar 31, 2026
495a9a3
fix: ensure newline at end of file in SkipToToolsMenu component
Mar 31, 2026
8b929f5
feat: refactor SkipToMain and SkipToToolsMenu components to use SkipL…
Mar 31, 2026
319706e
style: format SkipToToolsMenu component for improved readability
Mar 31, 2026
9cebdbe
Merge branch 'main' into fix/PxWeb2-716-extra-navigation-link
Apr 17, 2026
088260b
Merge branch 'main' into fix/PxWeb2-716-extra-navigation-link
Apr 20, 2026
895906c
fix: adjust margin for focus state in SkipToMain component
Apr 20, 2026
2860f22
fix: add aria-hidden attribute to header for accessibility
Apr 22, 2026
6fb817a
fix: format header component for improved readability
Apr 22, 2026
ac5b22a
Merge branch 'main' into fix/PxWeb2-716-extra-navigation-link
Apr 22, 2026
a9834d5
fix: add tabIndex to skipToMain div for improved accessibility
Apr 22, 2026
5ff023b
fix: correct formatting of skipToMain div for consistency
Apr 22, 2026
46ef537
fix: remove aria-hidden attribute from header for improved accessibility
Apr 22, 2026
d9073c1
fix: streamline header component formatting for improved readability
Apr 22, 2026
ad82d70
fix: enhance SkipToToolsMenu component to accept dynamic targetId for…
Apr 27, 2026
cac0065
fix: replace SkipToContent and SkipToMain components with SkipToTarge…
May 11, 2026
0d09364
Merge branch 'main' into fix/PxWeb2-716-extra-navigation-link
May 11, 2026
8a4c0b5
fix: simplify screen reader styles for better accessibility
May 11, 2026
32fc39c
fix: correct indentation in screen reader styles for consistency
May 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/pxweb2/public/locales/ar/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
}
},
"skip_to_main": "انتقل إلى المحتوى الرئيسي",
"skip_to_toolsmenu": " انتقل إلى قائمة الأدوات",
"switch_language_landmark": "اختر اللغة",
"footer": {
"language_header": "اللغة",
Expand Down
1 change: 1 addition & 0 deletions packages/pxweb2/public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
}
},
"skip_to_main": "Skip to main content",
"skip_to_toolsmenu": "Skip to tool menu for table",
"switch_language_landmark": "Select language",
"footer": {
"language_header": "Language",
Expand Down
3 changes: 2 additions & 1 deletion packages/pxweb2/public/locales/no/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"action_text": "Last siden på nytt"
}
},
"skip_to_main": "Hopp til hovedinnhold",
"skip_to_main": "Gå til hovedinnhold",
"skip_to_toolsmenu": "Gå til verktøymeny for tabell",
"switch_language_landmark": "Velg språk",
"footer": {
"language_header": "Språk",
Expand Down
1 change: 1 addition & 0 deletions packages/pxweb2/public/locales/sv/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
}
},
"skip_to_main": "Gå direkt till huvudinnehållet",
"skip_to_toolsmenu": "Gå direkt till verktygsmeny för tabell",
"switch_language_landmark": "Välj språk",
"footer": {
"language_header": "Språk",
Expand Down
1 change: 1 addition & 0 deletions packages/pxweb2/src/@types/resources.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ interface Resources {
logo_alt: 'To the front page';
};
skip_to_main: 'Skip to main content';
skip_to_toolsmenu: 'Skip to tool menu for table';
status_messages: {
drawer_edit: 'More tools for editing the table are under construction.';
drawer_help: 'The help section is under construction. It will be possible to set up links that point directly to your own help pages.';
Expand Down

This file was deleted.

This file was deleted.

48 changes: 0 additions & 48 deletions packages/pxweb2/src/app/components/SkipToMain/SkipToMain.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
.skip-to-main {
&:focus-within {
display: flex;
background-color: var(--px-color-surface-inverted);
width: 100%;
height: 48px;
justify-content: center;
margin: -1px;
}
}

.skip-to-content {
&:focus-within {
display: flex;
Expand All @@ -8,6 +19,7 @@
}
}

.skip-to-main a,
.skip-to-content a {
justify-content: center;
background-color: var(--px-color-surface-inverted);
Expand All @@ -28,16 +40,16 @@
}
}

.screen-reader-only {
.screen-reader-only-main {
&:not(:focus-within) {
position: absolute;
left: -99999px;
}
}

.screen-reader-only-content {
&:not(:focus-within) {
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
position: absolute;
left: -99999px;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
import React from 'react';
import cl from 'clsx';
import { useTranslation } from 'react-i18next';
import { useLocation, useSearchParams } from 'react-router';

import classes from './SkipToTarget.module.scss';
import { Link } from '@pxweb2/pxweb2-ui';
import { getConfig } from '../../util/config/getConfig';
import { getLanguagePath } from '../../util/language/getLanguagePath';

type SkipTranslationKey = 'common.skip_to_main' | 'common.skip_to_toolsmenu';

export type SkipToTargetProps = React.HTMLAttributes<HTMLDivElement> & {
targetId: string;
translationKey?: SkipTranslationKey;
label?: string;
styleVariant?: 'main' | 'content';
};

export const SkipToTarget = React.forwardRef<HTMLDivElement, SkipToTargetProps>(
(
{
targetId,
translationKey,
label,
styleVariant = 'main',
className = '',
...props
},
ref,
) => {
const { t, i18n } = useTranslation();
const config = getConfig();
const location = useLocation().pathname;
const [searchParams] = useSearchParams();

const basePath = getLanguagePath(
location,
i18n.language,
config.language.supportedLanguages,
config.language.defaultLanguage,
config.language.showDefaultLanguageInPath,
config.baseApplicationPath,
config.language.positionInPath,
);

// Build a single, URL-encoded query string from the search params.
const paramsString = searchParams.toString();
const params = paramsString ? `?${paramsString}` : '';
const path = `${basePath}${params}#${targetId}`;
const linkText = label ?? (translationKey ? t(translationKey) : '');

return (
<div
ref={ref}
className={cl(
styleVariant === 'content'
? classes['skip-to-content']
: classes['skip-to-main'],
styleVariant === 'content'
? classes['screen-reader-only-content']
: classes['screen-reader-only-main'],
className,
)}
{...props}
>
<Link href={path} size="medium">
{linkText}
</Link>
</div>
);
},
);

SkipToTarget.displayName = 'SkipToTarget';
8 changes: 5 additions & 3 deletions packages/pxweb2/src/app/pages/StartPage/StartPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { Header } from '../../components/Header/Header';
import { Footer } from '../../components/Footer/Footer';
import { ErrorMessage } from '../../components/ErrorMessage/ErrorMessage';
import { FilterSidebar } from '../../components/FilterSidebar/FilterSidebar';
import { SkipToContent } from '../../components/SkipToContent/SkipToContent';
import { SkipToTarget } from '../../components/SkipToTarget/SkipToTarget';
import { ActionType } from './StartPageTypes';
import {
getSubjectTree,
Expand Down Expand Up @@ -736,11 +736,13 @@ const StartPage = () => {
return (
<>
<nav>
<SkipToContent
<SkipToTarget
styleVariant="content"
targetId="px-start-filter"
label={t('start_page.skip_to.filter')}
/>
<SkipToContent
<SkipToTarget
styleVariant="content"
targetId="px-start-result"
label={t('start_page.skip_to.result')}
/>
Expand Down
Loading
Loading