@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.
@@ -8,22 +8,22 @@ $ tsup --dts
8
8
  CLI Cleaning output folder
9
9
  CJS Build start
10
10
  ESM Build start
11
- CJS dist/index.js 89.97 KB
12
- CJS dist/v2/index.js 70.74 KB
13
- CJS dist/index.js.map 175.39 KB
14
- CJS dist/v2/index.js.map 146.40 KB
15
- CJS ⚡️ Build success in 344ms
16
- ESM dist/esm/index.js 70.94 KB
17
11
  ESM dist/esm/v2/index.js 60.19 KB
12
+ ESM dist/esm/index.js 71.37 KB
18
13
  ESM dist/esm/chunk-ROQATIB7.js 9.15 KB
19
- ESM dist/esm/index.js.map 151.43 KB
20
14
  ESM dist/esm/v2/index.js.map 126.72 KB
15
+ ESM dist/esm/index.js.map 152.31 KB
21
16
  ESM dist/esm/chunk-ROQATIB7.js.map 22.93 KB
22
- ESM ⚡️ Build success in 344ms
17
+ ESM ⚡️ Build success in 402ms
18
+ CJS dist/index.js 90.48 KB
19
+ CJS dist/v2/index.js 70.74 KB
20
+ CJS dist/index.js.map 176.30 KB
21
+ CJS dist/v2/index.js.map 146.40 KB
22
+ CJS ⚡️ Build success in 403ms
23
23
  DTS Build start
24
- DTS ⚡️ Build success in 16182ms
25
- DTS dist/index.d.ts 39.06 KB
24
+ DTS ⚡️ Build success in 16150ms
25
+ DTS dist/index.d.ts 39.04 KB
26
26
  DTS dist/v2/index.d.ts 4.87 KB
27
- DTS dist/index.d.mts 39.06 KB
27
+ DTS dist/index.d.mts 39.04 KB
28
28
  DTS dist/v2/index.d.mts 4.87 KB
29
- Done in 17.64s.
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(() => resetSelectedMenuPath?.(), 100);
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);