@docusaurus/theme-classic 0.0.0-5492 → 0.0.0-5493
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.
|
@@ -47,9 +47,11 @@ function DropdownNavbarItemDesktop({
|
|
|
47
47
|
};
|
|
48
48
|
document.addEventListener('mousedown', handleClickOutside);
|
|
49
49
|
document.addEventListener('touchstart', handleClickOutside);
|
|
50
|
+
document.addEventListener('focusin', handleClickOutside);
|
|
50
51
|
return () => {
|
|
51
52
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
52
53
|
document.removeEventListener('touchstart', handleClickOutside);
|
|
54
|
+
document.removeEventListener('focusin', handleClickOutside);
|
|
53
55
|
};
|
|
54
56
|
}, [dropdownRef]);
|
|
55
57
|
return (
|
|
@@ -79,22 +81,6 @@ function DropdownNavbarItemDesktop({
|
|
|
79
81
|
{items.map((childItemProps, i) => (
|
|
80
82
|
<NavbarItem
|
|
81
83
|
isDropdownItem
|
|
82
|
-
onKeyDown={(e) => {
|
|
83
|
-
if (i === items.length - 1 && e.key === 'Tab') {
|
|
84
|
-
e.preventDefault();
|
|
85
|
-
setShowDropdown(false);
|
|
86
|
-
const nextNavbarItem = dropdownRef.current.nextElementSibling;
|
|
87
|
-
if (nextNavbarItem) {
|
|
88
|
-
const targetItem =
|
|
89
|
-
nextNavbarItem instanceof HTMLAnchorElement
|
|
90
|
-
? nextNavbarItem
|
|
91
|
-
: // Next item is another dropdown; focus on the inner
|
|
92
|
-
// anchor element instead so there's outline
|
|
93
|
-
nextNavbarItem.querySelector('a');
|
|
94
|
-
targetItem.focus();
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}}
|
|
98
84
|
activeClassName="dropdown__link--active"
|
|
99
85
|
{...childItemProps}
|
|
100
86
|
key={i}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-classic",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-5493",
|
|
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-
|
|
24
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
25
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
26
|
-
"@docusaurus/plugin-content-blog": "0.0.0-
|
|
27
|
-
"@docusaurus/plugin-content-docs": "0.0.0-
|
|
28
|
-
"@docusaurus/plugin-content-pages": "0.0.0-
|
|
29
|
-
"@docusaurus/theme-common": "0.0.0-
|
|
30
|
-
"@docusaurus/theme-translations": "0.0.0-
|
|
31
|
-
"@docusaurus/types": "0.0.0-
|
|
32
|
-
"@docusaurus/utils": "0.0.0-
|
|
33
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
34
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
23
|
+
"@docusaurus/core": "0.0.0-5493",
|
|
24
|
+
"@docusaurus/mdx-loader": "0.0.0-5493",
|
|
25
|
+
"@docusaurus/module-type-aliases": "0.0.0-5493",
|
|
26
|
+
"@docusaurus/plugin-content-blog": "0.0.0-5493",
|
|
27
|
+
"@docusaurus/plugin-content-docs": "0.0.0-5493",
|
|
28
|
+
"@docusaurus/plugin-content-pages": "0.0.0-5493",
|
|
29
|
+
"@docusaurus/theme-common": "0.0.0-5493",
|
|
30
|
+
"@docusaurus/theme-translations": "0.0.0-5493",
|
|
31
|
+
"@docusaurus/types": "0.0.0-5493",
|
|
32
|
+
"@docusaurus/utils": "0.0.0-5493",
|
|
33
|
+
"@docusaurus/utils-common": "0.0.0-5493",
|
|
34
|
+
"@docusaurus/utils-validation": "0.0.0-5493",
|
|
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": "
|
|
65
|
+
"gitHead": "57a8ffbdb5d78f6a790b2d84f3d6df652484f3c8"
|
|
66
66
|
}
|
|
@@ -54,7 +54,9 @@ function DropdownNavbarItemDesktop({
|
|
|
54
54
|
const [showDropdown, setShowDropdown] = useState(false);
|
|
55
55
|
|
|
56
56
|
useEffect(() => {
|
|
57
|
-
const handleClickOutside = (
|
|
57
|
+
const handleClickOutside = (
|
|
58
|
+
event: MouseEvent | TouchEvent | FocusEvent,
|
|
59
|
+
) => {
|
|
58
60
|
if (
|
|
59
61
|
!dropdownRef.current ||
|
|
60
62
|
dropdownRef.current.contains(event.target as Node)
|
|
@@ -66,10 +68,12 @@ function DropdownNavbarItemDesktop({
|
|
|
66
68
|
|
|
67
69
|
document.addEventListener('mousedown', handleClickOutside);
|
|
68
70
|
document.addEventListener('touchstart', handleClickOutside);
|
|
71
|
+
document.addEventListener('focusin', handleClickOutside);
|
|
69
72
|
|
|
70
73
|
return () => {
|
|
71
74
|
document.removeEventListener('mousedown', handleClickOutside);
|
|
72
75
|
document.removeEventListener('touchstart', handleClickOutside);
|
|
76
|
+
document.removeEventListener('focusin', handleClickOutside);
|
|
73
77
|
};
|
|
74
78
|
}, [dropdownRef]);
|
|
75
79
|
|
|
@@ -100,22 +104,6 @@ function DropdownNavbarItemDesktop({
|
|
|
100
104
|
{items.map((childItemProps, i) => (
|
|
101
105
|
<NavbarItem
|
|
102
106
|
isDropdownItem
|
|
103
|
-
onKeyDown={(e) => {
|
|
104
|
-
if (i === items.length - 1 && e.key === 'Tab') {
|
|
105
|
-
e.preventDefault();
|
|
106
|
-
setShowDropdown(false);
|
|
107
|
-
const nextNavbarItem = dropdownRef.current!.nextElementSibling;
|
|
108
|
-
if (nextNavbarItem) {
|
|
109
|
-
const targetItem =
|
|
110
|
-
nextNavbarItem instanceof HTMLAnchorElement
|
|
111
|
-
? nextNavbarItem
|
|
112
|
-
: // Next item is another dropdown; focus on the inner
|
|
113
|
-
// anchor element instead so there's outline
|
|
114
|
-
nextNavbarItem.querySelector('a')!;
|
|
115
|
-
targetItem.focus();
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}}
|
|
119
107
|
activeClassName="dropdown__link--active"
|
|
120
108
|
{...childItemProps}
|
|
121
109
|
key={i}
|