Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
18 changes: 18 additions & 0 deletions apps/site/components/withNavBar.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@reference "../styles/index.css";

.skipToContent {
@apply sr-only
focus:not-sr-only
focus:absolute
focus:top-4
focus:left-4
focus:z-50
focus:rounded
focus:bg-green-600
focus:px-4
focus:py-2
focus:text-white
focus:ring-2
focus:ring-green-400
Comment thread
ovflowd marked this conversation as resolved.
Outdated
focus:outline-none;
}
12 changes: 9 additions & 3 deletions apps/site/components/withNavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import LanguageDropdown from '@node-core/ui-components/Common/LanguageDropDown';
import Skeleton from '@node-core/ui-components/Common/Skeleton';
import NavBar from '@node-core/ui-components/Containers/NavBar';
// TODO(@AvivKeller): I don't like that we are importing styles from another module
import styles from '@node-core/ui-components/Containers/NavBar/index.module.css';
import navBarStyles from '@node-core/ui-components/Containers/NavBar/index.module.css';
import GitHubIcon from '@node-core/ui-components/Icons/Social/GitHub';
import { availableLocales } from '@node-core/website-i18n';
import dynamic from 'next/dynamic';
Expand All @@ -21,12 +21,14 @@ import { useRouter, usePathname } from '#site/navigation.mjs';
import type { SimpleLocaleConfig } from '@node-core/ui-components/types';
import type { FC } from 'react';

import styles from './withNavBar.module.css';

const ThemeToggle = dynamic(
() => import('@node-core/ui-components/Common/ThemeToggle'),
{
ssr: false,
loading: () => (
<Skeleton className={styles.themeToggleSkeleton} loading={true} />
<Skeleton className={navBarStyles.themeToggleSkeleton} loading={true} />
),
}
);
Expand Down Expand Up @@ -55,6 +57,10 @@ const WithNavBar: FC = () => {
<div>
<WithBanner section="index" />

<a href="#main" className={styles.skipToContent}>
{t('components.common.skipToContent')}
</a>
Comment thread
ovflowd marked this conversation as resolved.
Outdated

<NavBar
navItems={navigationItems.map(([, { label, link, target }]) => ({
link,
Expand Down Expand Up @@ -85,7 +91,7 @@ const WithNavBar: FC = () => {
<Link
href="https://github.com/nodejs/node"
aria-label="Node.js Github"
className={styles.ghIconWrapper}
className={navBarStyles.ghIconWrapper}
>
<GitHubIcon />
</Link>
Expand Down
4 changes: 3 additions & 1 deletion apps/site/layouts/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ const AboutLayout: FC<PropsWithChildren> = ({ children }) => (
<WithSidebar navKeys={['about', 'getInvolved']} />

<div>
<main>{children}</main>
<main id="main" tabIndex={-1}>
{children}
</main>

<WithMetaBar />
</div>
Expand Down
4 changes: 3 additions & 1 deletion apps/site/layouts/ArticlePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ const ArticlePageLayout: FC<PropsWithChildren> = ({ children }) => (
<WithSidebar navKeys={[]} />

<div>
<main>{children}</main>
<main id="main" tabIndex={-1}>
{children}
</main>

<WithMetaBar />
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/site/layouts/Blog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const BlogLayout: FC = () => {
<WithNavBar />

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

<WithBlogCategories
Expand Down
4 changes: 3 additions & 1 deletion apps/site/layouts/Default.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ const DefaultLayout: FC<PropsWithChildren> = ({ children }) => (
<WithSidebar navKeys={[]} />

<div>
<main>{children}</main>
<main id="main" tabIndex={-1}>
{children}
</main>
</div>
</Article>

Expand Down
2 changes: 1 addition & 1 deletion apps/site/layouts/Download.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const DownloadLayout: FC<PropsWithChildren> = async ({ children }) => {
<WithNavBar />

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

<WithDownloadSection releases={releases}>
Expand Down
4 changes: 3 additions & 1 deletion apps/site/layouts/DownloadArchive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ const DownloadArchiveLayout: FC<PropsWithChildren> = ({ children }) => (
<WithNavBar />

<div className={styles.downloadLayout}>
<main>{children}</main>
<main id="main" tabIndex={-1}>
{children}
</main>
</div>

<WithFooter />
Expand Down
2 changes: 2 additions & 0 deletions apps/site/layouts/GlowingBackdrop.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const GlowingBackdropLayout: FC<
<GlowingBackdrop />

<main
id="main"
tabIndex={-1}
className={classNames({
[styles.homeLayout]: kind === 'home',
})}
Expand Down
2 changes: 1 addition & 1 deletion apps/site/layouts/Learn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const LearnLayout: FC<PropsWithChildren> = ({ children }) => (
<WithSideBar navKeys={['learn']} />

<div>
<main>
<main id="main" tabIndex={-1}>
{children}

<WithSidebarCrossLinks navKey="learn" />
Expand Down
2 changes: 1 addition & 1 deletion apps/site/layouts/Post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const PostLayout: FC<PropsWithChildren> = ({ children }) => {

<div className={styles.contentLayout}>
<div className={styles.postLayout}>
<main>
<main id="main" tabIndex={-1}>
{type === 'vulnerability' && <EOLAlert />}

<h1>{frontmatter.title}</h1>
Expand Down
3 changes: 2 additions & 1 deletion packages/i18n/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@
"themeToggle": {
"light": "Switch to Light Mode",
"dark": "Switch to Dark Mode"
}
},
"skipToContent": "Skip to content"
Comment thread
avivkeller marked this conversation as resolved.
},
"metabar": {
"lastUpdated": "Last Updated",
Expand Down