@docusaurus/theme-classic 0.0.0-5574 → 0.0.0-5576

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.
@@ -6,7 +6,7 @@
6
6
  */
7
7
  import React, {useState, useCallback} from 'react';
8
8
  import clsx from 'clsx';
9
- import {ThemeClassNames} from '@docusaurus/theme-common';
9
+ import {prefersReducedMotion, ThemeClassNames} from '@docusaurus/theme-common';
10
10
  import {useDocsSidebar} from '@docusaurus/theme-common/internal';
11
11
  import {useLocation} from '@docusaurus/router';
12
12
  import DocSidebar from '@theme/DocSidebar';
@@ -34,6 +34,11 @@ export default function DocRootLayoutSidebar({
34
34
  if (hiddenSidebar) {
35
35
  setHiddenSidebar(false);
36
36
  }
37
+ // onTransitionEnd won't fire when sidebar animation is disabled
38
+ // fixes https://github.com/facebook/docusaurus/issues/8918
39
+ if (!hiddenSidebar && prefersReducedMotion()) {
40
+ setHiddenSidebar(true);
41
+ }
37
42
  setHiddenSidebarContainer((value) => !value);
38
43
  }, [setHiddenSidebarContainer, hiddenSidebar]);
39
44
  return (
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "0.0.0-5574",
3
+ "version": "0.0.0-5576",
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-5574",
24
- "@docusaurus/mdx-loader": "0.0.0-5574",
25
- "@docusaurus/module-type-aliases": "0.0.0-5574",
26
- "@docusaurus/plugin-content-blog": "0.0.0-5574",
27
- "@docusaurus/plugin-content-docs": "0.0.0-5574",
28
- "@docusaurus/plugin-content-pages": "0.0.0-5574",
29
- "@docusaurus/theme-common": "0.0.0-5574",
30
- "@docusaurus/theme-translations": "0.0.0-5574",
31
- "@docusaurus/types": "0.0.0-5574",
32
- "@docusaurus/utils": "0.0.0-5574",
33
- "@docusaurus/utils-common": "0.0.0-5574",
34
- "@docusaurus/utils-validation": "0.0.0-5574",
23
+ "@docusaurus/core": "0.0.0-5576",
24
+ "@docusaurus/mdx-loader": "0.0.0-5576",
25
+ "@docusaurus/module-type-aliases": "0.0.0-5576",
26
+ "@docusaurus/plugin-content-blog": "0.0.0-5576",
27
+ "@docusaurus/plugin-content-docs": "0.0.0-5576",
28
+ "@docusaurus/plugin-content-pages": "0.0.0-5576",
29
+ "@docusaurus/theme-common": "0.0.0-5576",
30
+ "@docusaurus/theme-translations": "0.0.0-5576",
31
+ "@docusaurus/types": "0.0.0-5576",
32
+ "@docusaurus/utils": "0.0.0-5576",
33
+ "@docusaurus/utils-common": "0.0.0-5576",
34
+ "@docusaurus/utils-validation": "0.0.0-5576",
35
35
  "@mdx-js/react": "^2.1.5",
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": "e1b202828b53b2ea84d6d884df81e5a20e26b9cd"
65
+ "gitHead": "8011ec6c8c46329b1596b7f2213c4b45ff31d27f"
66
66
  }
@@ -7,7 +7,7 @@
7
7
 
8
8
  import React, {type ReactNode, useState, useCallback} from 'react';
9
9
  import clsx from 'clsx';
10
- import {ThemeClassNames} from '@docusaurus/theme-common';
10
+ import {prefersReducedMotion, ThemeClassNames} from '@docusaurus/theme-common';
11
11
  import {useDocsSidebar} from '@docusaurus/theme-common/internal';
12
12
  import {useLocation} from '@docusaurus/router';
13
13
  import DocSidebar from '@theme/DocSidebar';
@@ -40,6 +40,11 @@ export default function DocRootLayoutSidebar({
40
40
  if (hiddenSidebar) {
41
41
  setHiddenSidebar(false);
42
42
  }
43
+ // onTransitionEnd won't fire when sidebar animation is disabled
44
+ // fixes https://github.com/facebook/docusaurus/issues/8918
45
+ if (!hiddenSidebar && prefersReducedMotion()) {
46
+ setHiddenSidebar(true);
47
+ }
43
48
  setHiddenSidebarContainer((value) => !value);
44
49
  }, [setHiddenSidebarContainer, hiddenSidebar]);
45
50