@sproutsocial/seeds-react-menu 1.7.5 → 1.7.7
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/.turbo/turbo-build.log +12 -12
- package/CHANGELOG.md +23 -0
- package/dist/esm/index.js +19 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +38 -22
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/MenuRoot/MenuRoot.tsx +0 -1
- package/src/NestedMenu/NestedMenu.stories.tsx +94 -0
- package/src/NestedMenu/NestedMenu.tsx +2 -0
- package/src/NestedMenu/NestedMenuPopout.tsx +18 -1
- package/src/NestedMenu/__tests__/NestedMenu.test.tsx +83 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -8,22 +8,22 @@ $ tsup --dts
|
|
|
8
8
|
[34mCLI[39m Cleaning output folder
|
|
9
9
|
[34mCJS[39m Build start
|
|
10
10
|
[34mESM[39m Build start
|
|
11
|
-
[32mCJS[39m [1mdist/index.js [22m[32m89.97 KB[39m
|
|
12
|
-
[32mCJS[39m [1mdist/v2/index.js [22m[32m70.74 KB[39m
|
|
13
|
-
[32mCJS[39m [1mdist/index.js.map [22m[32m175.39 KB[39m
|
|
14
|
-
[32mCJS[39m [1mdist/v2/index.js.map [22m[32m146.40 KB[39m
|
|
15
|
-
[32mCJS[39m ⚡️ Build success in 344ms
|
|
16
|
-
[32mESM[39m [1mdist/esm/index.js [22m[32m70.94 KB[39m
|
|
17
11
|
[32mESM[39m [1mdist/esm/v2/index.js [22m[32m60.19 KB[39m
|
|
12
|
+
[32mESM[39m [1mdist/esm/index.js [22m[32m71.37 KB[39m
|
|
18
13
|
[32mESM[39m [1mdist/esm/chunk-ROQATIB7.js [22m[32m9.15 KB[39m
|
|
19
|
-
[32mESM[39m [1mdist/esm/index.js.map [22m[32m151.43 KB[39m
|
|
20
14
|
[32mESM[39m [1mdist/esm/v2/index.js.map [22m[32m126.72 KB[39m
|
|
15
|
+
[32mESM[39m [1mdist/esm/index.js.map [22m[32m152.31 KB[39m
|
|
21
16
|
[32mESM[39m [1mdist/esm/chunk-ROQATIB7.js.map [22m[32m22.93 KB[39m
|
|
22
|
-
[32mESM[39m ⚡️ Build success in
|
|
17
|
+
[32mESM[39m ⚡️ Build success in 402ms
|
|
18
|
+
[32mCJS[39m [1mdist/index.js [22m[32m90.48 KB[39m
|
|
19
|
+
[32mCJS[39m [1mdist/v2/index.js [22m[32m70.74 KB[39m
|
|
20
|
+
[32mCJS[39m [1mdist/index.js.map [22m[32m176.30 KB[39m
|
|
21
|
+
[32mCJS[39m [1mdist/v2/index.js.map [22m[32m146.40 KB[39m
|
|
22
|
+
[32mCJS[39m ⚡️ Build success in 403ms
|
|
23
23
|
[34mDTS[39m Build start
|
|
24
|
-
[32mDTS[39m ⚡️ Build success in
|
|
25
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m39.
|
|
24
|
+
[32mDTS[39m ⚡️ Build success in 16150ms
|
|
25
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m39.04 KB[39m
|
|
26
26
|
[32mDTS[39m [1mdist/v2/index.d.ts [22m[32m4.87 KB[39m
|
|
27
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m39.
|
|
27
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m39.04 KB[39m
|
|
28
28
|
[32mDTS[39m [1mdist/v2/index.d.mts [22m[32m4.87 KB[39m
|
|
29
|
-
Done in 17.
|
|
29
|
+
Done in 17.57s.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @sproutsocial/seeds-react-menu
|
|
2
2
|
|
|
3
|
+
## 1.7.7
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 564ce83: Fix NestedMenu focus management to return focus to toggle button when menu closes (DS-3901)
|
|
8
|
+
|
|
9
|
+
**Changes:**
|
|
10
|
+
|
|
11
|
+
- Added `toggleElementRef` to NestedMenu component to track toggle button element
|
|
12
|
+
- Merged refs in NestedMenuPopout using `mergeRefs()` utility to combine Popout's ref with internal ref
|
|
13
|
+
- Added explicit focus management in `onClose` callback to ensure focus returns to toggle button
|
|
14
|
+
- Added focus management tests to verify behavior
|
|
15
|
+
- Added Storybook story "Focus Management (DS-3901)" to demonstrate the fix
|
|
16
|
+
|
|
17
|
+
**Impact:**
|
|
18
|
+
Users navigating by keyboard will now properly have focus returned to the toggle button when NestedMenu closes via Escape key, clicking menu items, or navigating through nested menus. This improves accessibility and keyboard navigation UX.
|
|
19
|
+
|
|
20
|
+
## 1.7.6
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- 9811c09: Remove layout animation to make searching less crazy
|
|
25
|
+
|
|
3
26
|
## 1.7.5
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
package/dist/esm/index.js
CHANGED
|
@@ -650,7 +650,6 @@ var menuPlacementOrigin = {
|
|
|
650
650
|
["right-end"]: { originX: 0, originY: 1 }
|
|
651
651
|
};
|
|
652
652
|
var menuAnimationConfig = {
|
|
653
|
-
layout: true,
|
|
654
653
|
variants: {
|
|
655
654
|
initial: (custom = { placement: "bottom" }) => ({
|
|
656
655
|
...menuPlacementOrigin[custom.placement],
|
|
@@ -2208,8 +2207,10 @@ var NestedMenuRoot = ({
|
|
|
2208
2207
|
};
|
|
2209
2208
|
|
|
2210
2209
|
// src/NestedMenu/NestedMenuPopout.tsx
|
|
2210
|
+
import "react";
|
|
2211
2211
|
import { motion as motion2 } from "motion/react";
|
|
2212
2212
|
import styled9 from "styled-components";
|
|
2213
|
+
import { mergeRefs as mergeRefs4 } from "@sproutsocial/seeds-react-utilities";
|
|
2213
2214
|
import { jsx as jsx30 } from "react/jsx-runtime";
|
|
2214
2215
|
var StyledDiv = styled9(motion2.div)`
|
|
2215
2216
|
overflow: hidden;
|
|
@@ -2219,6 +2220,8 @@ var NestedMenuPopout = ({
|
|
|
2219
2220
|
menuToggleElement,
|
|
2220
2221
|
width,
|
|
2221
2222
|
onClose,
|
|
2223
|
+
toggleElementRef,
|
|
2224
|
+
focusLockProps,
|
|
2222
2225
|
...popoutProps
|
|
2223
2226
|
}) => {
|
|
2224
2227
|
const { activeMenuContext, rootMenuContextProps, resetSelectedMenuPath } = useNestedMenuContext();
|
|
@@ -2228,13 +2231,20 @@ var NestedMenuPopout = ({
|
|
|
2228
2231
|
lockPlacement: true,
|
|
2229
2232
|
onClose: () => {
|
|
2230
2233
|
onClose?.();
|
|
2231
|
-
setTimeout(() =>
|
|
2234
|
+
setTimeout(() => {
|
|
2235
|
+
toggleElementRef.current?.focus();
|
|
2236
|
+
resetSelectedMenuPath?.();
|
|
2237
|
+
}, 200);
|
|
2232
2238
|
},
|
|
2233
2239
|
isOpen: !!rootMenuContextProps.isOpen,
|
|
2234
2240
|
openMenu: rootMenuContextProps.openMenu,
|
|
2235
2241
|
closeMenu: rootMenuContextProps.closeMenu,
|
|
2236
2242
|
width,
|
|
2237
2243
|
content: (props) => /* @__PURE__ */ jsx30(StyledDiv, { layout: "position", children: typeof content === "function" ? content(props) : content }),
|
|
2244
|
+
focusLockProps: {
|
|
2245
|
+
crossFrame: false,
|
|
2246
|
+
...focusLockProps
|
|
2247
|
+
},
|
|
2238
2248
|
...popoutProps,
|
|
2239
2249
|
children: (toggleProps) => /* @__PURE__ */ jsx30(
|
|
2240
2250
|
MenuToggleProvider,
|
|
@@ -2242,7 +2252,11 @@ var NestedMenuPopout = ({
|
|
|
2242
2252
|
menuContext: {
|
|
2243
2253
|
...activeMenuContext,
|
|
2244
2254
|
...rootMenuContextProps,
|
|
2245
|
-
...toggleProps
|
|
2255
|
+
...toggleProps,
|
|
2256
|
+
ref: mergeRefs4(
|
|
2257
|
+
toggleProps.ref,
|
|
2258
|
+
toggleElementRef
|
|
2259
|
+
)
|
|
2246
2260
|
},
|
|
2247
2261
|
children: menuToggleElement
|
|
2248
2262
|
}
|
|
@@ -2320,6 +2334,7 @@ var NestedMenu = ({
|
|
|
2320
2334
|
const [currentMenuId, setCurrentMenuId] = useState(initialMenuId);
|
|
2321
2335
|
const [isAdding, setIsAdding] = useState(false);
|
|
2322
2336
|
const popoutUpdateRef = useRef2();
|
|
2337
|
+
const toggleElementRef = useRef2(null);
|
|
2323
2338
|
const setSelectedMenuId = (id) => {
|
|
2324
2339
|
setIsAdding(true);
|
|
2325
2340
|
setSelectedMenuPath((currentPath) => [...currentPath, id]);
|
|
@@ -2484,6 +2499,7 @@ var NestedMenu = ({
|
|
|
2484
2499
|
) }),
|
|
2485
2500
|
menuToggleElement,
|
|
2486
2501
|
width,
|
|
2502
|
+
toggleElementRef,
|
|
2487
2503
|
scheduleUpdateRef: (callback) => {
|
|
2488
2504
|
popoutUpdateRef.current = callback;
|
|
2489
2505
|
externalPopoutUpdateRef?.(callback);
|