Skip to content

Commit db3bed3

Browse files
authored
feat(ui): Added Skip To Content (#8514)
* feat(ui): Added Skip To Content * feat(ui): moved Skip to Content as a component, added test and storybook file * feat(tests): remove SkipToContentButton test file * feat(ui): refactor SkipToContentButton to use children prop instead of label * feat(ui): update WithNavBar component structure for improved accessibility
1 parent 65e1378 commit db3bed3

File tree

14 files changed

+79
-9
lines changed

14 files changed

+79
-9
lines changed

apps/site/components/withNavBar.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import LanguageDropdown from '@node-core/ui-components/Common/LanguageDropDown';
44
import Skeleton from '@node-core/ui-components/Common/Skeleton';
5+
import SkipToContentButton from '@node-core/ui-components/Common/SkipToContentButton';
56
import NavBar from '@node-core/ui-components/Containers/NavBar';
67
// TODO(@AvivKeller): I don't like that we are importing styles from another module
78
import styles from '@node-core/ui-components/Containers/NavBar/index.module.css';
@@ -53,6 +54,10 @@ const WithNavBar: FC = () => {
5354

5455
return (
5556
<div>
57+
<SkipToContentButton>
58+
{t('components.common.skipToContent')}
59+
</SkipToContentButton>
60+
5661
<WithBanner section="index" />
5762

5863
<NavBar

apps/site/layouts/About.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ const AboutLayout: FC<PropsWithChildren> = ({ children }) => (
1616
<WithSidebar navKeys={['about', 'getInvolved']} />
1717

1818
<div>
19-
<main>{children}</main>
19+
<main id="main" tabIndex={-1}>
20+
{children}
21+
</main>
2022

2123
<WithMetaBar />
2224
</div>

apps/site/layouts/ArticlePage.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ const ArticlePageLayout: FC<PropsWithChildren> = ({ children }) => (
1515
<WithSidebar navKeys={[]} />
1616

1717
<div>
18-
<main>{children}</main>
18+
<main id="main" tabIndex={-1}>
19+
{children}
20+
</main>
1921

2022
<WithMetaBar />
2123
</div>

apps/site/layouts/Blog.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ const BlogLayout: FC = () => {
5454
<WithNavBar />
5555

5656
<div className={styles.blogLayout}>
57-
<main>
57+
<main id="main" tabIndex={-1}>
5858
<BlogHeader category={blogData.category} />
5959

6060
<WithBlogCategories

apps/site/layouts/Default.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ const DefaultLayout: FC<PropsWithChildren> = ({ children }) => (
1414
<WithSidebar navKeys={[]} />
1515

1616
<div>
17-
<main>{children}</main>
17+
<main id="main" tabIndex={-1}>
18+
{children}
19+
</main>
1820
</div>
1921
</Article>
2022

apps/site/layouts/Download.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const DownloadLayout: FC<PropsWithChildren> = async ({ children }) => {
1818
<WithNavBar />
1919

2020
<div className={styles.downloadLayout}>
21-
<main>
21+
<main id="main" tabIndex={-1}>
2222
<h1>{frontmatter.title}</h1>
2323

2424
<WithDownloadSection releases={releases}>

apps/site/layouts/DownloadArchive.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ const DownloadArchiveLayout: FC<PropsWithChildren> = ({ children }) => (
1010
<WithNavBar />
1111

1212
<div className={styles.downloadLayout}>
13-
<main>{children}</main>
13+
<main id="main" tabIndex={-1}>
14+
{children}
15+
</main>
1416
</div>
1517

1618
<WithFooter />

apps/site/layouts/GlowingBackdrop.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ const GlowingBackdropLayout: FC<
2222
<GlowingBackdrop />
2323

2424
<main
25+
id="main"
26+
tabIndex={-1}
2527
className={classNames({
2628
[styles.homeLayout]: kind === 'home',
2729
})}

apps/site/layouts/Learn.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const LearnLayout: FC<PropsWithChildren> = ({ children }) => (
1717
<WithSideBar navKeys={['learn']} />
1818

1919
<div>
20-
<main>
20+
<main id="main" tabIndex={-1}>
2121
{children}
2222

2323
<WithSidebarCrossLinks navKey="learn" />

apps/site/layouts/Post.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const PostLayout: FC<PropsWithChildren> = ({ children }) => {
2727

2828
<div className={styles.contentLayout}>
2929
<div className={styles.postLayout}>
30-
<main>
30+
<main id="main" tabIndex={-1}>
3131
{type === 'vulnerability' && <EOLAlert />}
3232

3333
<h1>{frontmatter.title}</h1>

0 commit comments

Comments
 (0)