@dloizides/ui-layout 1.26.2 → 1.26.4

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
@@ -144,11 +144,14 @@ var styles3 = reactNative.StyleSheet.create({
144
144
  paddingHorizontal: DEFAULT_PADDING_H,
145
145
  paddingVertical: DEFAULT_PADDING_V,
146
146
  borderRadius: DEFAULT_BORDER_RADIUS,
147
- alignSelf: "flex-start"
147
+ alignSelf: "flex-start",
148
+ // Never wider than the container: a long label wraps inside the pill instead of being clipped.
149
+ maxWidth: "100%"
148
150
  },
149
151
  text: {
150
152
  fontSize: DEFAULT_FONT_SIZE,
151
- fontWeight: "600"
153
+ fontWeight: "600",
154
+ flexShrink: 1
152
155
  }
153
156
  });
154
157
  var StatusBadge = ({
@@ -586,6 +589,8 @@ var styles6 = reactNative.StyleSheet.create({
586
589
  // node (the `menuRef` outside-click / keyboard logic and the web portal target depend on it).
587
590
  // `transformOrigin: 'top'` makes the scale grow downward FROM the anchor rather than the centre.
588
591
  animated: { transformOrigin: "top" },
592
+ // Exit fade only: the dying popover must not receive the next click. See the file header.
593
+ inert: { pointerEvents: "none" },
589
594
  // Bound the scroll viewport so a list longer than the popover scrolls (with a scrollbar) instead of
590
595
  // overflowing the frame — the popover's own maxHeight cannot do this (see MENU_SCROLL_MAX_HEIGHT).
591
596
  scroll: { maxHeight: MENU_SCROLL_MAX_HEIGHT }
@@ -612,12 +617,18 @@ var InlineMenu = ({
612
617
  [options, value]
613
618
  );
614
619
  const [highlightedIndex, setHighlightedIndex] = React10.useState(() => selectedIndex);
620
+ const handleSelect = React10.useCallback(
621
+ (optionValue) => {
622
+ if (isOpen) onSelect(optionValue);
623
+ },
624
+ [isOpen, onSelect]
625
+ );
615
626
  const selectAt = React10.useCallback(
616
627
  (index) => {
617
628
  const option = options[index];
618
- if (option !== void 0) onSelect(option.value);
629
+ if (option !== void 0) handleSelect(option.value);
619
630
  },
620
- [options, onSelect]
631
+ [options, handleSelect]
621
632
  );
622
633
  const selectHighlighted = React10.useCallback(
623
634
  () => {
@@ -650,20 +661,28 @@ var InlineMenu = ({
650
661
  {
651
662
  ref: menuRef,
652
663
  accessibilityRole: "menu",
664
+ "aria-hidden": !isOpen,
653
665
  "aria-label": accessibilityLabel,
654
666
  style: popoverStyle,
655
667
  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,
668
+ children: /* @__PURE__ */ jsxRuntime.jsx(
669
+ reactNative.Animated.View,
658
670
  {
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
- )) }) })
671
+ pointerEvents: isOpen ? "auto" : "none",
672
+ style: [styles6.animated, animatedStyle, isOpen ? null : styles6.inert],
673
+ children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { style: styles6.scroll, keyboardShouldPersistTaps: "handled", children: options.map((option, index) => /* @__PURE__ */ jsxRuntime.jsx(
674
+ OptionRow,
675
+ {
676
+ isHighlighted: index === highlightedIndex,
677
+ isSelected: option.value === value,
678
+ label: option.label,
679
+ testID: optionTestID !== void 0 ? optionTestID(option.value) : `${testID}-option-${String(option.value)}`,
680
+ onSelect: () => handleSelect(option.value)
681
+ },
682
+ String(option.value)
683
+ )) })
684
+ }
685
+ )
667
686
  }
668
687
  );
669
688
  if (IS_WEB2) return reactDom.createPortal(menu, document.body);