-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/pxweb2 404 skip to main link (#404)
* Added text for language support * Added skip to main component * Added id for skip link. Added SkipToMain component in app.tsx. * Change selector to hide div when link inside is not focused.
- Loading branch information
Showing
9 changed files
with
66 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
packages/pxweb2/src/app/components/SkipToMain/SkipToMain.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
.skip-to-main { | ||
&:focus-within { | ||
display: flex; | ||
background-color: var(--px-color-surface-inverted); | ||
width: 100%; | ||
height: 48px; | ||
justify-content: center; | ||
} | ||
} | ||
|
||
.skip-to-main a { | ||
justify-content: center; | ||
background-color: var(--px-color-surface-inverted); | ||
color: var(--px-color-text-on-inverted); | ||
height: 44px; | ||
|
||
&:focus-visible { | ||
outline-offset: -6px; | ||
padding: 0px 12px; | ||
box-shadow: none; | ||
} | ||
|
||
&:hover, | ||
&:active { | ||
background-color: var(--px-color-surface-inverted); | ||
color: var(--px-color-text-on-inverted); | ||
} | ||
} | ||
|
||
.screen-reader-only { | ||
&:not(:focus-within) { | ||
width: 1px !important; | ||
height: 1px !important; | ||
padding: 0 !important; | ||
margin: -1px !important; | ||
overflow: hidden !important; | ||
clip: rect(0, 0, 0, 0) !important; | ||
white-space: nowrap !important; | ||
border: 0 !important; | ||
} | ||
} |
17 changes: 17 additions & 0 deletions
17
packages/pxweb2/src/app/components/SkipToMain/SkipToMain.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import React from 'react'; | ||
import classes from './SkipToMain.module.scss'; | ||
import cl from 'clsx'; | ||
import { Link } from '@pxweb2/pxweb2-ui'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
export const SkipToMain: React.FC = () => { | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<div className={cl(classes['skip-to-main'], classes['screen-reader-only'])}> | ||
<Link href="#px-main-content" size="medium"> | ||
{t('common.skip_to_main')} | ||
</Link> | ||
</div> | ||
); | ||
}; |