@dloizides/ui-nav 1.10.1 → 1.10.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/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.10.2
4
+
5
+ - **Fix (the mobile nav DRAWER was not clickable — a tap on a nav item did not navigate, it
6
+ just closed the drawer / did nothing, in all seven portals below 768px).**
7
+ `MobileDrawer` rendered a full-bleed scrim `Pressable` (`StyleSheet.absoluteFillObject`) and a
8
+ panel `View` with `{ position: 'absolute', top: 0, bottom: 0, left: 0 }` — **no width and no
9
+ zIndex**. Reproduced structurally: the panel's computed `width` was empty and its `zIndex` was
10
+ `0`; the scrim's computed `left`/`right` were both `0px` at `zIndex` `0`. So the scrim FULLY
11
+ overlapped the panel at the SAME stacking level, and on react-native-web the equal-zIndex scrim
12
+ won the pointer (the estate's known "RN-web Pressable swallows a sibling/child press" trap):
13
+ the tap closed the drawer and the nav-item's `TouchableOpacity` `onPress` (→ the app's router)
14
+ never fired.
15
+ - Fixed once, in the kit: the panel now has an explicit drawer **width** (`280px`), a solid
16
+ surface background, and a `zIndex` **above** the scrim; the scrim is anchored BESIDE the panel
17
+ (`left: DRAWER_WIDTH`) so its tap-to-close hit area never overlaps the panel. Nav-item taps
18
+ reach the `Sidebar` leaves; taps beside the drawer still close it.
19
+ - Guarded by `src/mobileDrawer.test.tsx` (RED-first): three structural assertions read the
20
+ resolved geometry via `getComputedStyle` and FAIL against the pre-fix panel/scrim (no width,
21
+ equal zIndex, overlapping scrim); two behavioural assertions lock the contract (nav-item tap
22
+ navigates + closes; scrim tap only closes).
23
+ - **No API change.** Consumers need no edit — bump the dependency and the drawer works.
24
+
3
25
  ## 1.10.1
4
26
 
5
27
  - **Fix (a plain-string slot logged `console.error` on EVERY render, in all seven portals).**
package/dist/index.js CHANGED
@@ -1004,6 +1004,9 @@ var MENU_MIN_TARGET = 44;
1004
1004
  var MENU_GLYPH_FONT_SIZE = 20;
1005
1005
  var MENU_TOGGLE_PADDING = 12;
1006
1006
  var DRAWER_Z_INDEX = 50;
1007
+ var DRAWER_WIDTH = 280;
1008
+ var SCRIM_Z_INDEX = 1;
1009
+ var PANEL_Z_INDEX = 2;
1007
1010
  var NAV_ACTIVATABLE_SELECTOR = 'a, [role="button"], [role="link"]';
1008
1011
  var DEFAULT_DRAWER_LABELS = {
1009
1012
  openLabel: "Menu",
@@ -1013,8 +1016,22 @@ var DEFAULT_DRAWER_LABELS = {
1013
1016
  };
1014
1017
  var styles2 = reactNative.StyleSheet.create({
1015
1018
  overlay: { ...reactNative.StyleSheet.absoluteFillObject, zIndex: DRAWER_Z_INDEX },
1016
- scrim: { ...reactNative.StyleSheet.absoluteFillObject, backgroundColor: SCRIM_COLOR },
1017
- panel: { position: "absolute", top: 0, bottom: 0, left: 0 },
1019
+ // The scrim's tap-to-close hit area is anchored to the RIGHT of the panel
1020
+ // (`left: DRAWER_WIDTH`), so it NEVER overlaps the panel: nav-item taps always
1021
+ // reach the Sidebar's TouchableOpacity, while taps beside the drawer still close.
1022
+ scrim: {
1023
+ position: "absolute",
1024
+ top: 0,
1025
+ bottom: 0,
1026
+ left: DRAWER_WIDTH,
1027
+ right: 0,
1028
+ backgroundColor: SCRIM_COLOR,
1029
+ zIndex: SCRIM_Z_INDEX
1030
+ },
1031
+ // The panel gets an explicit width (a real drawer) AND a zIndex above the scrim,
1032
+ // so on react-native-web it — and the nav leaves inside it — sit above the scrim
1033
+ // and receive presses instead of the scrim swallowing them.
1034
+ panel: { position: "absolute", top: 0, bottom: 0, left: 0, width: DRAWER_WIDTH, zIndex: PANEL_Z_INDEX },
1018
1035
  menuToggle: {
1019
1036
  minWidth: MENU_MIN_TARGET,
1020
1037
  minHeight: MENU_MIN_TARGET,
@@ -1071,7 +1088,17 @@ var MobileDrawer = ({
1071
1088
  onPress: onClose
1072
1089
  }
1073
1090
  ),
1074
- /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { ref: panelRef, "aria-modal": true, role: "dialog", style: styles2.panel, testID: drawerTestID, children: renderTextSlot(sidebar, { color: theme.colors.text }) })
1091
+ /* @__PURE__ */ jsxRuntime.jsx(
1092
+ reactNative.View,
1093
+ {
1094
+ ref: panelRef,
1095
+ "aria-modal": true,
1096
+ role: "dialog",
1097
+ style: [styles2.panel, { backgroundColor: theme.colors.surface }],
1098
+ testID: drawerTestID,
1099
+ children: renderTextSlot(sidebar, { color: theme.colors.text })
1100
+ }
1101
+ )
1075
1102
  ] });
1076
1103
  };
1077
1104