impact-ui 3.7.26-alpha.1 → 3.7.26-alpha.2
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.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/Sidebar/index.js +14 -31
package/package.json
CHANGED
|
@@ -22,18 +22,18 @@ export const Sidebar = ({
|
|
|
22
22
|
visibleModulesCount,
|
|
23
23
|
}) => {
|
|
24
24
|
const sidebarRef = useRef(null);
|
|
25
|
-
const prevFocusRef = useRef(null);
|
|
25
|
+
// const prevFocusRef = useRef(null);
|
|
26
26
|
|
|
27
|
-
const handleToggle = useCallback(() => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}, [isOpen, handleClose]);
|
|
27
|
+
// const handleToggle = useCallback(() => {
|
|
28
|
+
// if (!isOpen) {
|
|
29
|
+
// prevFocusRef.current = document.activeElement;
|
|
30
|
+
// } else {
|
|
31
|
+
// setTimeout(() => {
|
|
32
|
+
// prevFocusRef.current?.focus();
|
|
33
|
+
// }, 0);
|
|
34
|
+
// }
|
|
35
|
+
// handleClose();
|
|
36
|
+
// }, [isOpen, handleClose]);
|
|
37
37
|
|
|
38
38
|
useShortcut(
|
|
39
39
|
[
|
|
@@ -41,24 +41,7 @@ export const Sidebar = ({
|
|
|
41
41
|
keys: "mod+b",
|
|
42
42
|
id: "sidebar-toggle-mod-b",
|
|
43
43
|
description: "Toggle sidebar",
|
|
44
|
-
handler:
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
keys: "alt+s",
|
|
48
|
-
id: "sidebar-focus-alt-s",
|
|
49
|
-
description: "Focus sidebar navigation",
|
|
50
|
-
handler: () => {
|
|
51
|
-
if (!isOpen) {
|
|
52
|
-
prevFocusRef.current = document.activeElement;
|
|
53
|
-
handleClose();
|
|
54
|
-
}
|
|
55
|
-
setTimeout(() => {
|
|
56
|
-
const firstItem = sidebarRef.current?.querySelector(
|
|
57
|
-
"[tabindex]:not([tabindex='-1'])"
|
|
58
|
-
);
|
|
59
|
-
firstItem?.focus();
|
|
60
|
-
}, 50);
|
|
61
|
-
},
|
|
44
|
+
handler: () => setIsOpen(!isOpen),
|
|
62
45
|
},
|
|
63
46
|
{
|
|
64
47
|
keys: "alt+l",
|
|
@@ -106,11 +89,11 @@ export const Sidebar = ({
|
|
|
106
89
|
role="button"
|
|
107
90
|
tabIndex={0}
|
|
108
91
|
aria-label={isOpen ? "Collapse sidebar" : "Expand sidebar"}
|
|
109
|
-
onClick={
|
|
92
|
+
onClick={handleClose}
|
|
110
93
|
onKeyDown={(e) => {
|
|
111
94
|
if (e.key === "Enter" || e.key === " ") {
|
|
112
95
|
e.preventDefault();
|
|
113
|
-
|
|
96
|
+
handleClose();
|
|
114
97
|
}
|
|
115
98
|
}}
|
|
116
99
|
>
|