@docusaurus/theme-classic 0.0.0-5335 → 0.0.0-5341

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -348,6 +348,13 @@ function getSwizzleConfig() {
348
348
  // By default it's an empty placeholder for the user to fill
349
349
  description: 'The search bar component of your site, appearing in the navbar.',
350
350
  },
351
+ SkipToContent: {
352
+ actions: {
353
+ eject: 'safe',
354
+ wrap: 'safe',
355
+ },
356
+ description: 'The component responsible for implementing the accessibility "skip to content" link (https://www.w3.org/TR/WCAG20-TECHS/G1.html)',
357
+ },
351
358
  'prism-include-languages': {
352
359
  actions: {
353
360
  eject: 'safe',
@@ -7,7 +7,11 @@
7
7
  import React from 'react';
8
8
  import clsx from 'clsx';
9
9
  import ErrorBoundary from '@docusaurus/ErrorBoundary';
10
- import {PageMetadata, ThemeClassNames} from '@docusaurus/theme-common';
10
+ import {
11
+ PageMetadata,
12
+ SkipToContentFallbackId,
13
+ ThemeClassNames,
14
+ } from '@docusaurus/theme-common';
11
15
  import {useKeyboardNavigation} from '@docusaurus/theme-common/internal';
12
16
  import SkipToContent from '@theme/SkipToContent';
13
17
  import AnnouncementBar from '@theme/AnnouncementBar';
@@ -37,6 +41,7 @@ export default function Layout(props) {
37
41
  <Navbar />
38
42
 
39
43
  <div
44
+ id={SkipToContentFallbackId}
40
45
  className={clsx(
41
46
  ThemeClassNames.wrapper.main,
42
47
  styles.mainWrapper,
@@ -6,6 +6,7 @@
6
6
  */
7
7
  import React from 'react';
8
8
  import {useNavbarMobileSidebar} from '@docusaurus/theme-common/internal';
9
+ import {translate} from '@docusaurus/Translate';
9
10
  import NavbarColorModeToggle from '@theme/Navbar/ColorModeToggle';
10
11
  import IconClose from '@theme/Icon/Close';
11
12
  import NavbarLogo from '@theme/Navbar/Logo';
@@ -14,6 +15,11 @@ function CloseButton() {
14
15
  return (
15
16
  <button
16
17
  type="button"
18
+ aria-label={translate({
19
+ id: 'theme.docs.sidebar.closeSidebarButtonAriaLabel',
20
+ message: 'Close navigation bar',
21
+ description: 'The ARIA label for close button of mobile sidebar',
22
+ })}
17
23
  className="clean-btn navbar-sidebar__close"
18
24
  onClick={() => mobileSidebar.toggle()}>
19
25
  <IconClose color="var(--ifm-color-emphasis-600)" />
@@ -6,17 +6,22 @@
6
6
  */
7
7
  import React from 'react';
8
8
  import {useNavbarMobileSidebar} from '@docusaurus/theme-common/internal';
9
+ import {translate} from '@docusaurus/Translate';
9
10
  import IconMenu from '@theme/Icon/Menu';
10
11
  export default function MobileSidebarToggle() {
11
- const mobileSidebar = useNavbarMobileSidebar();
12
+ const {toggle, shown} = useNavbarMobileSidebar();
12
13
  return (
13
14
  <button
14
- onClick={mobileSidebar.toggle}
15
- onKeyDown={mobileSidebar.toggle}
16
- aria-label="Navigation bar toggle"
15
+ onClick={toggle}
16
+ aria-label={translate({
17
+ id: 'theme.docs.sidebar.toggleSidebarButtonAriaLabel',
18
+ message: 'Toggle navigation bar',
19
+ description:
20
+ 'The ARIA label for hamburger menu button of mobile navigation',
21
+ })}
22
+ aria-expanded={shown}
17
23
  className="navbar__toggle clean-btn"
18
- type="button"
19
- tabIndex={0}>
24
+ type="button">
20
25
  <IconMenu />
21
26
  </button>
22
27
  );
@@ -5,24 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  import React from 'react';
8
- import Translate, {translate} from '@docusaurus/Translate';
9
- import {useSkipToContent} from '@docusaurus/theme-common/internal';
8
+ import {SkipToContentLink} from '@docusaurus/theme-common';
10
9
  import styles from './styles.module.css';
11
10
  export default function SkipToContent() {
12
- const {containerRef, handleSkip} = useSkipToContent();
13
- return (
14
- <div
15
- ref={containerRef}
16
- role="region"
17
- aria-label={translate({id: 'theme.common.skipToMainContent'})}>
18
- {/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
19
- <a href="#" className={styles.skipToContent} onClick={handleSkip}>
20
- <Translate
21
- id="theme.common.skipToMainContent"
22
- description="The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation">
23
- Skip to main content
24
- </Translate>
25
- </a>
26
- </div>
27
- );
11
+ return <SkipToContentLink className={styles.skipToContent} />;
28
12
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "0.0.0-5335",
3
+ "version": "0.0.0-5341",
4
4
  "description": "Classic theme for Docusaurus",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/theme-classic.d.ts",
@@ -20,18 +20,18 @@
20
20
  "copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
21
21
  },
22
22
  "dependencies": {
23
- "@docusaurus/core": "0.0.0-5335",
24
- "@docusaurus/mdx-loader": "0.0.0-5335",
25
- "@docusaurus/module-type-aliases": "0.0.0-5335",
26
- "@docusaurus/plugin-content-blog": "0.0.0-5335",
27
- "@docusaurus/plugin-content-docs": "0.0.0-5335",
28
- "@docusaurus/plugin-content-pages": "0.0.0-5335",
29
- "@docusaurus/theme-common": "0.0.0-5335",
30
- "@docusaurus/theme-translations": "0.0.0-5335",
31
- "@docusaurus/types": "0.0.0-5335",
32
- "@docusaurus/utils": "0.0.0-5335",
33
- "@docusaurus/utils-common": "0.0.0-5335",
34
- "@docusaurus/utils-validation": "0.0.0-5335",
23
+ "@docusaurus/core": "0.0.0-5341",
24
+ "@docusaurus/mdx-loader": "0.0.0-5341",
25
+ "@docusaurus/module-type-aliases": "0.0.0-5341",
26
+ "@docusaurus/plugin-content-blog": "0.0.0-5341",
27
+ "@docusaurus/plugin-content-docs": "0.0.0-5341",
28
+ "@docusaurus/plugin-content-pages": "0.0.0-5341",
29
+ "@docusaurus/theme-common": "0.0.0-5341",
30
+ "@docusaurus/theme-translations": "0.0.0-5341",
31
+ "@docusaurus/types": "0.0.0-5341",
32
+ "@docusaurus/utils": "0.0.0-5341",
33
+ "@docusaurus/utils-common": "0.0.0-5341",
34
+ "@docusaurus/utils-validation": "0.0.0-5341",
35
35
  "@mdx-js/react": "^1.6.22",
36
36
  "clsx": "^1.2.1",
37
37
  "copy-text-to-clipboard": "^3.0.1",
@@ -62,5 +62,5 @@
62
62
  "engines": {
63
63
  "node": ">=16.14"
64
64
  },
65
- "gitHead": "42c59e0828b093f765f6c37d522c02ef74846a31"
65
+ "gitHead": "d74e9a571123b90c4effb2e1b2d4765c88bcb94f"
66
66
  }
@@ -377,6 +377,14 @@ export default function getSwizzleConfig(): SwizzleConfig {
377
377
  description:
378
378
  'The search bar component of your site, appearing in the navbar.',
379
379
  },
380
+ SkipToContent: {
381
+ actions: {
382
+ eject: 'safe',
383
+ wrap: 'safe',
384
+ },
385
+ description:
386
+ 'The component responsible for implementing the accessibility "skip to content" link (https://www.w3.org/TR/WCAG20-TECHS/G1.html)',
387
+ },
380
388
  'prism-include-languages': {
381
389
  actions: {
382
390
  eject: 'safe',
@@ -8,7 +8,11 @@
8
8
  import React from 'react';
9
9
  import clsx from 'clsx';
10
10
  import ErrorBoundary from '@docusaurus/ErrorBoundary';
11
- import {PageMetadata, ThemeClassNames} from '@docusaurus/theme-common';
11
+ import {
12
+ PageMetadata,
13
+ SkipToContentFallbackId,
14
+ ThemeClassNames,
15
+ } from '@docusaurus/theme-common';
12
16
  import {useKeyboardNavigation} from '@docusaurus/theme-common/internal';
13
17
  import SkipToContent from '@theme/SkipToContent';
14
18
  import AnnouncementBar from '@theme/AnnouncementBar';
@@ -42,6 +46,7 @@ export default function Layout(props: Props): JSX.Element {
42
46
  <Navbar />
43
47
 
44
48
  <div
49
+ id={SkipToContentFallbackId}
45
50
  className={clsx(
46
51
  ThemeClassNames.wrapper.main,
47
52
  styles.mainWrapper,
@@ -7,6 +7,7 @@
7
7
 
8
8
  import React from 'react';
9
9
  import {useNavbarMobileSidebar} from '@docusaurus/theme-common/internal';
10
+ import {translate} from '@docusaurus/Translate';
10
11
  import NavbarColorModeToggle from '@theme/Navbar/ColorModeToggle';
11
12
  import IconClose from '@theme/Icon/Close';
12
13
  import NavbarLogo from '@theme/Navbar/Logo';
@@ -16,6 +17,11 @@ function CloseButton() {
16
17
  return (
17
18
  <button
18
19
  type="button"
20
+ aria-label={translate({
21
+ id: 'theme.docs.sidebar.closeSidebarButtonAriaLabel',
22
+ message: 'Close navigation bar',
23
+ description: 'The ARIA label for close button of mobile sidebar',
24
+ })}
19
25
  className="clean-btn navbar-sidebar__close"
20
26
  onClick={() => mobileSidebar.toggle()}>
21
27
  <IconClose color="var(--ifm-color-emphasis-600)" />
@@ -7,18 +7,23 @@
7
7
 
8
8
  import React from 'react';
9
9
  import {useNavbarMobileSidebar} from '@docusaurus/theme-common/internal';
10
+ import {translate} from '@docusaurus/Translate';
10
11
  import IconMenu from '@theme/Icon/Menu';
11
12
 
12
13
  export default function MobileSidebarToggle(): JSX.Element {
13
- const mobileSidebar = useNavbarMobileSidebar();
14
+ const {toggle, shown} = useNavbarMobileSidebar();
14
15
  return (
15
16
  <button
16
- onClick={mobileSidebar.toggle}
17
- onKeyDown={mobileSidebar.toggle}
18
- aria-label="Navigation bar toggle"
17
+ onClick={toggle}
18
+ aria-label={translate({
19
+ id: 'theme.docs.sidebar.toggleSidebarButtonAriaLabel',
20
+ message: 'Toggle navigation bar',
21
+ description:
22
+ 'The ARIA label for hamburger menu button of mobile navigation',
23
+ })}
24
+ aria-expanded={shown}
19
25
  className="navbar__toggle clean-btn"
20
- type="button"
21
- tabIndex={0}>
26
+ type="button">
22
27
  <IconMenu />
23
28
  </button>
24
29
  );
@@ -6,26 +6,10 @@
6
6
  */
7
7
 
8
8
  import React from 'react';
9
- import Translate, {translate} from '@docusaurus/Translate';
10
- import {useSkipToContent} from '@docusaurus/theme-common/internal';
9
+ import {SkipToContentLink} from '@docusaurus/theme-common';
11
10
 
12
11
  import styles from './styles.module.css';
13
12
 
14
13
  export default function SkipToContent(): JSX.Element {
15
- const {containerRef, handleSkip} = useSkipToContent();
16
- return (
17
- <div
18
- ref={containerRef}
19
- role="region"
20
- aria-label={translate({id: 'theme.common.skipToMainContent'})}>
21
- {/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
22
- <a href="#" className={styles.skipToContent} onClick={handleSkip}>
23
- <Translate
24
- id="theme.common.skipToMainContent"
25
- description="The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation">
26
- Skip to main content
27
- </Translate>
28
- </a>
29
- </div>
30
- );
14
+ return <SkipToContentLink className={styles.skipToContent} />;
31
15
  }