@dloizides/ui-layout 1.26.2 → 1.26.3

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/CHANGELOG.md CHANGED
@@ -1,6 +1,18 @@
1
1
  # Changelog
2
2
 
3
3
 
4
+ ## 1.26.3
5
+
6
+ ### Fixed
7
+
8
+ - `ModalDropdown` / `InlineMenu`: a closed-but-still-fading popover was INTERACTIVE for the whole
9
+ 120ms exit animation — no `pointerEvents`, no `aria-hidden` — so a fast second click could select
10
+ an option from a menu the user had already dismissed, and screen readers still saw the options.
11
+ The popover now goes inert the instant `isOpen` goes false (`aria-hidden` on the menu node,
12
+ `pointerEvents: 'none'` on the animated wrapper, and the select handler refuses a closed menu).
13
+ The fade is unchanged. Covered by `ModalDropdown.openState.test.tsx` — the fade is held open
14
+ deliberately, since the reduced-motion test harness collapses it to 0ms.
15
+
4
16
  ## 1.26.2
5
17
 
6
18
  ### Fixed
package/dist/index.js CHANGED
@@ -586,6 +586,8 @@ var styles6 = reactNative.StyleSheet.create({
586
586
  // node (the `menuRef` outside-click / keyboard logic and the web portal target depend on it).
587
587
  // `transformOrigin: 'top'` makes the scale grow downward FROM the anchor rather than the centre.
588
588
  animated: { transformOrigin: "top" },
589
+ // Exit fade only: the dying popover must not receive the next click. See the file header.
590
+ inert: { pointerEvents: "none" },
589
591
  // Bound the scroll viewport so a list longer than the popover scrolls (with a scrollbar) instead of
590
592
  // overflowing the frame — the popover's own maxHeight cannot do this (see MENU_SCROLL_MAX_HEIGHT).
591
593
  scroll: { maxHeight: MENU_SCROLL_MAX_HEIGHT }
@@ -612,12 +614,18 @@ var InlineMenu = ({
612
614
  [options, value]
613
615
  );
614
616
  const [highlightedIndex, setHighlightedIndex] = React10.useState(() => selectedIndex);
617
+ const handleSelect = React10.useCallback(
618
+ (optionValue) => {
619
+ if (isOpen) onSelect(optionValue);
620
+ },
621
+ [isOpen, onSelect]
622
+ );
615
623
  const selectAt = React10.useCallback(
616
624
  (index) => {
617
625
  const option = options[index];
618
- if (option !== void 0) onSelect(option.value);
626
+ if (option !== void 0) handleSelect(option.value);
619
627
  },
620
- [options, onSelect]
628
+ [options, handleSelect]
621
629
  );
622
630
  const selectHighlighted = React10.useCallback(
623
631
  () => {
@@ -650,20 +658,28 @@ var InlineMenu = ({
650
658
  {
651
659
  ref: menuRef,
652
660
  accessibilityRole: "menu",
661
+ "aria-hidden": !isOpen,
653
662
  "aria-label": accessibilityLabel,
654
663
  style: popoverStyle,
655
664
  testID: `${testID}-menu`,
656
- children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.Animated.View, { style: [styles6.animated, animatedStyle], children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { style: styles6.scroll, keyboardShouldPersistTaps: "handled", children: options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsx(
657
- OptionRow,
665
+ children: /* @__PURE__ */ jsxRuntime.jsx(
666
+ reactNative.Animated.View,
658
667
  {
659
- isHighlighted: index === highlightedIndex,
660
- isSelected: option.value === value,
661
- label: option.label,
662
- testID: optionTestID !== void 0 ? optionTestID(option.value) : `${testID}-option-${String(option.value)}`,
663
- onSelect: () => onSelect(option.value)
664
- },
665
- String(option.value)
666
- )) }) })
668
+ pointerEvents: isOpen ? "auto" : "none",
669
+ style: [styles6.animated, animatedStyle, isOpen ? null : styles6.inert],
670
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { style: styles6.scroll, keyboardShouldPersistTaps: "handled", children: options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsx(
671
+ OptionRow,
672
+ {
673
+ isHighlighted: index === highlightedIndex,
674
+ isSelected: option.value === value,
675
+ label: option.label,
676
+ testID: optionTestID !== void 0 ? optionTestID(option.value) : `${testID}-option-${String(option.value)}`,
677
+ onSelect: () => handleSelect(option.value)
678
+ },
679
+ String(option.value)
680
+ )) })
681
+ }
682
+ )
667
683
  }
668
684
  );
669
685
  if (IS_WEB2) return reactDom.createPortal(menu, document.body);