@samline/drawer 2.0.4 → 2.0.6

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/dist/index.mjs CHANGED
@@ -1099,7 +1099,7 @@ var require_react_development = __commonJS({
1099
1099
  var dispatcher = resolveDispatcher();
1100
1100
  return dispatcher.useReducer(reducer, initialArg, init);
1101
1101
  }
1102
- function useRef10(initialValue) {
1102
+ function useRef11(initialValue) {
1103
1103
  var dispatcher = resolveDispatcher();
1104
1104
  return dispatcher.useRef(initialValue);
1105
1105
  }
@@ -1893,7 +1893,7 @@ var require_react_development = __commonJS({
1893
1893
  exports.useLayoutEffect = useLayoutEffect5;
1894
1894
  exports.useMemo = useMemo6;
1895
1895
  exports.useReducer = useReducer3;
1896
- exports.useRef = useRef10;
1896
+ exports.useRef = useRef11;
1897
1897
  exports.useState = useState10;
1898
1898
  exports.useSyncExternalStore = useSyncExternalStore;
1899
1899
  exports.useTransition = useTransition;
@@ -26962,25 +26962,34 @@ var nonTextInputTypes = /* @__PURE__ */ new Set([
26962
26962
  "submit",
26963
26963
  "reset"
26964
26964
  ]);
26965
- var preventScrollCount = 0;
26966
- var restore;
26965
+ var activePreventScrollLocks = /* @__PURE__ */ new Set();
26966
+ var activePreventScrollRestore = null;
26967
+ function acquirePreventScrollLock(lockId) {
26968
+ activePreventScrollLocks.add(lockId);
26969
+ if (activePreventScrollLocks.size === 1 && isIOS()) {
26970
+ activePreventScrollRestore = preventScrollMobileSafari();
26971
+ }
26972
+ }
26973
+ function releasePreventScrollLock(lockId) {
26974
+ activePreventScrollLocks.delete(lockId);
26975
+ if (activePreventScrollLocks.size === 0) {
26976
+ activePreventScrollRestore?.();
26977
+ activePreventScrollRestore = null;
26978
+ }
26979
+ }
26967
26980
  function usePreventScroll(options = {}) {
26968
26981
  let { isDisabled } = options;
26982
+ const lockIdRef = (0, import_react3.useRef)();
26983
+ if (!lockIdRef.current) {
26984
+ lockIdRef.current = /* @__PURE__ */ Symbol("drawer-prevent-scroll-lock");
26985
+ }
26969
26986
  useIsomorphicLayoutEffect2(() => {
26970
26987
  if (isDisabled) {
26971
26988
  return;
26972
26989
  }
26973
- preventScrollCount++;
26974
- if (preventScrollCount === 1) {
26975
- if (isIOS()) {
26976
- restore = preventScrollMobileSafari();
26977
- }
26978
- }
26990
+ acquirePreventScrollLock(lockIdRef.current);
26979
26991
  return () => {
26980
- preventScrollCount--;
26981
- if (preventScrollCount === 0) {
26982
- restore?.();
26983
- }
26992
+ releasePreventScrollLock(lockIdRef.current);
26984
26993
  };
26985
26994
  }, [isDisabled]);
26986
26995
  }
@@ -27554,12 +27563,23 @@ function useScaleBackground() {
27554
27563
  const { direction, isOpen, shouldScaleBackground, setBackgroundColorOnScale, noBodyStyles } = useDrawerContext();
27555
27564
  const timeoutIdRef = import_react6.default.useRef(null);
27556
27565
  const initialBackgroundColor = (0, import_react6.useMemo)(() => document.body.style.backgroundColor, []);
27566
+ import_react6.default.useEffect(() => {
27567
+ return () => {
27568
+ if (timeoutIdRef.current !== null) {
27569
+ window.clearTimeout(timeoutIdRef.current);
27570
+ timeoutIdRef.current = null;
27571
+ }
27572
+ };
27573
+ }, []);
27557
27574
  function getScale() {
27558
27575
  return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
27559
27576
  }
27560
27577
  import_react6.default.useEffect(() => {
27561
27578
  if (isOpen && shouldScaleBackground) {
27562
- if (timeoutIdRef.current) clearTimeout(timeoutIdRef.current);
27579
+ if (timeoutIdRef.current !== null) {
27580
+ clearTimeout(timeoutIdRef.current);
27581
+ timeoutIdRef.current = null;
27582
+ }
27563
27583
  const wrapper = document.querySelector("[data-drawer-wrapper]");
27564
27584
  if (!wrapper) return;
27565
27585
  chain(
@@ -27588,6 +27608,7 @@ function useScaleBackground() {
27588
27608
  } else {
27589
27609
  document.body.style.removeProperty("background");
27590
27610
  }
27611
+ timeoutIdRef.current = null;
27591
27612
  }, TRANSITIONS.DURATION * 1e3);
27592
27613
  };
27593
27614
  }
@@ -27597,6 +27618,14 @@ function useScaleBackground() {
27597
27618
  // src/use-position-fixed.ts
27598
27619
  var import_react7 = __toESM(require_react());
27599
27620
  var previousBodyPosition = null;
27621
+ var activeBodyPositionLocks = /* @__PURE__ */ new Set();
27622
+ var bodyPositionTimeoutId = null;
27623
+ function clearBodyPositionTimeout() {
27624
+ if (bodyPositionTimeoutId !== null) {
27625
+ window.clearTimeout(bodyPositionTimeoutId);
27626
+ bodyPositionTimeoutId = null;
27627
+ }
27628
+ }
27600
27629
  function usePositionFixed({
27601
27630
  isOpen,
27602
27631
  modal,
@@ -27607,8 +27636,17 @@ function usePositionFixed({
27607
27636
  }) {
27608
27637
  const [activeUrl, setActiveUrl] = import_react7.default.useState(() => typeof window !== "undefined" ? window.location.href : "");
27609
27638
  const scrollPos = import_react7.default.useRef(0);
27639
+ const lockIdRef = import_react7.default.useRef();
27640
+ if (!lockIdRef.current) {
27641
+ lockIdRef.current = /* @__PURE__ */ Symbol("drawer-body-position-lock");
27642
+ }
27610
27643
  const setPositionFixed = import_react7.default.useCallback(() => {
27611
27644
  if (!isSafari()) return;
27645
+ const lockId = lockIdRef.current;
27646
+ if (activeBodyPositionLocks.has(lockId)) {
27647
+ return;
27648
+ }
27649
+ activeBodyPositionLocks.add(lockId);
27612
27650
  if (previousBodyPosition === null && isOpen && !noBodyStyles) {
27613
27651
  previousBodyPosition = {
27614
27652
  position: document.body.style.position,
@@ -27625,7 +27663,8 @@ function usePositionFixed({
27625
27663
  right: "0px",
27626
27664
  height: "auto"
27627
27665
  });
27628
- window.setTimeout(
27666
+ clearBodyPositionTimeout();
27667
+ bodyPositionTimeoutId = window.setTimeout(
27629
27668
  () => window.requestAnimationFrame(() => {
27630
27669
  const bottomBarHeight = innerHeight - window.innerHeight;
27631
27670
  if (bottomBarHeight && scrollPos.current >= innerHeight) {
@@ -27635,10 +27674,16 @@ function usePositionFixed({
27635
27674
  300
27636
27675
  );
27637
27676
  }
27638
- }, [isOpen]);
27677
+ }, [isOpen, noBodyStyles]);
27639
27678
  const restorePositionSetting = import_react7.default.useCallback(() => {
27640
27679
  if (!isSafari()) return;
27680
+ const lockId = lockIdRef.current;
27681
+ activeBodyPositionLocks.delete(lockId);
27682
+ if (activeBodyPositionLocks.size > 0) {
27683
+ return;
27684
+ }
27641
27685
  if (previousBodyPosition !== null && !noBodyStyles) {
27686
+ clearBodyPositionTimeout();
27642
27687
  const y = -parseInt(document.body.style.top, 10);
27643
27688
  const x = -parseInt(document.body.style.left, 10);
27644
27689
  Object.assign(document.body.style, previousBodyPosition);
@@ -27651,7 +27696,7 @@ function usePositionFixed({
27651
27696
  });
27652
27697
  previousBodyPosition = null;
27653
27698
  }
27654
- }, [activeUrl]);
27699
+ }, [activeUrl, noBodyStyles, setActiveUrl]);
27655
27700
  import_react7.default.useEffect(() => {
27656
27701
  function onScroll() {
27657
27702
  scrollPos.current = window.scrollY;
@@ -27918,6 +27963,7 @@ function getDragPermission({
27918
27963
  }
27919
27964
 
27920
27965
  // src/react/components.tsx
27966
+ var useSafeLayoutEffect = typeof window === "undefined" ? import_react9.default.useEffect : import_react9.default.useLayoutEffect;
27921
27967
  function Root2({
27922
27968
  open: openProp,
27923
27969
  onOpenChange,
@@ -27949,6 +27995,12 @@ function Root2({
27949
27995
  container,
27950
27996
  autoFocus = false
27951
27997
  }) {
27998
+ const animationEndTimeoutRef = import_react9.default.useRef(null);
27999
+ const nonModalPointerEventsRafRef = import_react9.default.useRef(null);
28000
+ const shouldAnimateRafRef = import_react9.default.useRef(null);
28001
+ const snapPointsResetTimeoutRef = import_react9.default.useRef(null);
28002
+ const justReleasedTimeoutRef = import_react9.default.useRef(null);
28003
+ const touchEndHandlerRef = import_react9.default.useRef(null);
27952
28004
  const [isOpen = false, setIsOpen] = useControllableState2({
27953
28005
  defaultProp: defaultOpen,
27954
28006
  prop: openProp,
@@ -27957,13 +28009,20 @@ function Root2({
27957
28009
  if (!o && !nested) {
27958
28010
  restorePositionSetting();
27959
28011
  }
27960
- setTimeout(() => {
28012
+ if (animationEndTimeoutRef.current !== null) {
28013
+ window.clearTimeout(animationEndTimeoutRef.current);
28014
+ }
28015
+ animationEndTimeoutRef.current = window.setTimeout(() => {
27961
28016
  onAnimationEnd?.(o);
27962
28017
  }, TRANSITIONS.DURATION * 1e3);
27963
28018
  if (o && !modal) {
27964
28019
  if (typeof window !== "undefined") {
27965
- window.requestAnimationFrame(() => {
28020
+ if (nonModalPointerEventsRafRef.current !== null) {
28021
+ window.cancelAnimationFrame(nonModalPointerEventsRafRef.current);
28022
+ }
28023
+ nonModalPointerEventsRafRef.current = window.requestAnimationFrame(() => {
27966
28024
  document.body.style.pointerEvents = "auto";
28025
+ nonModalPointerEventsRafRef.current = null;
27967
28026
  });
27968
28027
  }
27969
28028
  }
@@ -28048,18 +28107,22 @@ function Root2({
28048
28107
  noBodyStyles,
28049
28108
  autoFocus
28050
28109
  });
28051
- import_react9.default.useEffect(() => {
28110
+ useSafeLayoutEffect(() => {
28052
28111
  if (!isOpen || !modal || autoFocus || typeof document === "undefined") {
28053
28112
  return;
28054
28113
  }
28055
28114
  const activeElement = document.activeElement;
28056
- if (!(activeElement instanceof HTMLElement)) {
28115
+ if (!activeElement || activeElement === document.body) {
28057
28116
  return;
28058
28117
  }
28059
- if (drawerRef.current?.contains(activeElement) || activeElement.closest("[data-drawer]")) {
28118
+ const activeElementNode = activeElement;
28119
+ if (drawerRef.current?.contains(activeElementNode) || activeElementNode.closest?.("[data-drawer]")) {
28060
28120
  return;
28061
28121
  }
28062
- activeElement.blur();
28122
+ if (typeof activeElementNode.blur !== "function") {
28123
+ return;
28124
+ }
28125
+ activeElementNode.blur();
28063
28126
  }, [autoFocus, isOpen, modal]);
28064
28127
  function getScale() {
28065
28128
  return (window.innerWidth - WINDOW_TOP_OFFSET) / window.innerWidth;
@@ -28072,7 +28135,15 @@ function Root2({
28072
28135
  setIsDragging(true);
28073
28136
  dragStartTime.current = /* @__PURE__ */ new Date();
28074
28137
  if (isIOS()) {
28075
- window.addEventListener("touchend", () => isAllowedToDrag.current = false, { once: true });
28138
+ if (touchEndHandlerRef.current) {
28139
+ window.removeEventListener("touchend", touchEndHandlerRef.current);
28140
+ }
28141
+ const handleTouchEnd = () => {
28142
+ isAllowedToDrag.current = false;
28143
+ touchEndHandlerRef.current = null;
28144
+ };
28145
+ touchEndHandlerRef.current = handleTouchEnd;
28146
+ window.addEventListener("touchend", handleTouchEnd, { once: true });
28076
28147
  }
28077
28148
  event.target.setPointerCapture(event.pointerId);
28078
28149
  pointerStart.current = isVertical(direction) ? event.pageY : event.pageX;
@@ -28179,9 +28250,15 @@ function Root2({
28179
28250
  }
28180
28251
  }
28181
28252
  import_react9.default.useEffect(() => {
28182
- window.requestAnimationFrame(() => {
28253
+ shouldAnimateRafRef.current = window.requestAnimationFrame(() => {
28183
28254
  shouldAnimate.current = true;
28184
28255
  });
28256
+ return () => {
28257
+ if (shouldAnimateRafRef.current !== null) {
28258
+ window.cancelAnimationFrame(shouldAnimateRafRef.current);
28259
+ shouldAnimateRafRef.current = null;
28260
+ }
28261
+ };
28185
28262
  }, []);
28186
28263
  import_react9.default.useEffect(() => {
28187
28264
  function onVisualViewportChange() {
@@ -28222,10 +28299,14 @@ function Root2({
28222
28299
  if (!fromWithin) {
28223
28300
  setIsOpen(false);
28224
28301
  }
28225
- setTimeout(() => {
28302
+ if (snapPointsResetTimeoutRef.current !== null) {
28303
+ window.clearTimeout(snapPointsResetTimeoutRef.current);
28304
+ }
28305
+ snapPointsResetTimeoutRef.current = window.setTimeout(() => {
28226
28306
  if (snapPoints) {
28227
28307
  setActiveSnapPoint(snapPoints[0]);
28228
28308
  }
28309
+ snapPointsResetTimeoutRef.current = null;
28229
28310
  }, TRANSITIONS.DURATION * 1e3);
28230
28311
  }
28231
28312
  function resetDrawer() {
@@ -28300,8 +28381,12 @@ function Root2({
28300
28381
  });
28301
28382
  if (releaseResult.shouldPreventFocus) {
28302
28383
  setJustReleased(true);
28303
- setTimeout(() => {
28384
+ if (justReleasedTimeoutRef.current !== null) {
28385
+ window.clearTimeout(justReleasedTimeoutRef.current);
28386
+ }
28387
+ justReleasedTimeoutRef.current = window.setTimeout(() => {
28304
28388
  setJustReleased(false);
28389
+ justReleasedTimeoutRef.current = null;
28305
28390
  }, 200);
28306
28391
  }
28307
28392
  if (releaseResult.action === "close") {
@@ -28375,11 +28460,44 @@ function Root2({
28375
28460
  });
28376
28461
  }
28377
28462
  }
28463
+ import_react9.default.useEffect(() => {
28464
+ return () => {
28465
+ if (animationEndTimeoutRef.current !== null) {
28466
+ window.clearTimeout(animationEndTimeoutRef.current);
28467
+ }
28468
+ if (nonModalPointerEventsRafRef.current !== null) {
28469
+ window.cancelAnimationFrame(nonModalPointerEventsRafRef.current);
28470
+ }
28471
+ if (snapPointsResetTimeoutRef.current !== null) {
28472
+ window.clearTimeout(snapPointsResetTimeoutRef.current);
28473
+ }
28474
+ if (justReleasedTimeoutRef.current !== null) {
28475
+ window.clearTimeout(justReleasedTimeoutRef.current);
28476
+ }
28477
+ if (nestedOpenChangeTimer.current) {
28478
+ window.clearTimeout(nestedOpenChangeTimer.current);
28479
+ }
28480
+ if (touchEndHandlerRef.current) {
28481
+ window.removeEventListener("touchend", touchEndHandlerRef.current);
28482
+ touchEndHandlerRef.current = null;
28483
+ }
28484
+ };
28485
+ }, []);
28378
28486
  import_react9.default.useEffect(() => {
28379
28487
  if (!modal) {
28380
- window.requestAnimationFrame(() => {
28488
+ if (nonModalPointerEventsRafRef.current !== null) {
28489
+ window.cancelAnimationFrame(nonModalPointerEventsRafRef.current);
28490
+ }
28491
+ nonModalPointerEventsRafRef.current = window.requestAnimationFrame(() => {
28381
28492
  document.body.style.pointerEvents = "auto";
28493
+ nonModalPointerEventsRafRef.current = null;
28382
28494
  });
28495
+ return () => {
28496
+ if (nonModalPointerEventsRafRef.current !== null) {
28497
+ window.cancelAnimationFrame(nonModalPointerEventsRafRef.current);
28498
+ nonModalPointerEventsRafRef.current = null;
28499
+ }
28500
+ };
28383
28501
  }
28384
28502
  }, [modal]);
28385
28503
  return /* @__PURE__ */ import_react9.default.createElement(
@@ -28486,15 +28604,23 @@ var Content2 = import_react9.default.forwardRef(function({ onPointerDownOutside,
28486
28604
  const pointerStartRef = import_react9.default.useRef(null);
28487
28605
  const lastKnownPointerEventRef = import_react9.default.useRef(null);
28488
28606
  const wasBeyondThePointRef = import_react9.default.useRef(false);
28607
+ const delayedSnapPointsRafRef = import_react9.default.useRef(null);
28489
28608
  const hasSnapPoints = snapPoints && snapPoints.length > 0;
28490
28609
  useScaleBackground();
28491
28610
  import_react9.default.useEffect(() => {
28492
28611
  if (hasSnapPoints) {
28493
- window.requestAnimationFrame(() => {
28612
+ delayedSnapPointsRafRef.current = window.requestAnimationFrame(() => {
28494
28613
  setDelayedSnapPoints(true);
28614
+ delayedSnapPointsRafRef.current = null;
28495
28615
  });
28496
28616
  }
28497
- }, []);
28617
+ return () => {
28618
+ if (delayedSnapPointsRafRef.current !== null) {
28619
+ window.cancelAnimationFrame(delayedSnapPointsRafRef.current);
28620
+ delayedSnapPointsRafRef.current = null;
28621
+ }
28622
+ };
28623
+ }, [hasSnapPoints]);
28498
28624
  function handleOnPointerUp(event) {
28499
28625
  pointerStartRef.current = null;
28500
28626
  wasBeyondThePointRef.current = false;
@@ -28603,13 +28729,14 @@ var Handle = import_react9.default.forwardRef(function({ preventCycle = false, c
28603
28729
  onDrag
28604
28730
  } = useDrawerContext();
28605
28731
  const closeTimeoutIdRef = import_react9.default.useRef(null);
28732
+ const cycleTimeoutIdRef = import_react9.default.useRef(null);
28606
28733
  const shouldCancelInteractionRef = import_react9.default.useRef(false);
28607
28734
  function handleStartCycle() {
28608
28735
  if (shouldCancelInteractionRef.current) {
28609
28736
  handleCancelInteraction();
28610
28737
  return;
28611
28738
  }
28612
- window.setTimeout(() => {
28739
+ cycleTimeoutIdRef.current = window.setTimeout(() => {
28613
28740
  handleCycleSnapPoints();
28614
28741
  }, DOUBLE_TAP_TIMEOUT);
28615
28742
  }
@@ -28640,9 +28767,19 @@ var Handle = import_react9.default.forwardRef(function({ preventCycle = false, c
28640
28767
  function handleCancelInteraction() {
28641
28768
  if (closeTimeoutIdRef.current) {
28642
28769
  window.clearTimeout(closeTimeoutIdRef.current);
28770
+ closeTimeoutIdRef.current = null;
28771
+ }
28772
+ if (cycleTimeoutIdRef.current) {
28773
+ window.clearTimeout(cycleTimeoutIdRef.current);
28774
+ cycleTimeoutIdRef.current = null;
28643
28775
  }
28644
28776
  shouldCancelInteractionRef.current = false;
28645
28777
  }
28778
+ import_react9.default.useEffect(() => {
28779
+ return () => {
28780
+ handleCancelInteraction();
28781
+ };
28782
+ }, []);
28646
28783
  return /* @__PURE__ */ import_react9.default.createElement(
28647
28784
  "div",
28648
28785
  {
@@ -28723,7 +28860,7 @@ var VISUALLY_HIDDEN_STYLE = {
28723
28860
  whiteSpace: "nowrap",
28724
28861
  border: 0
28725
28862
  };
28726
- var useSafeLayoutEffect = typeof window === "undefined" ? import_react10.default.useEffect : import_react10.default.useLayoutEffect;
28863
+ var useSafeLayoutEffect2 = typeof window === "undefined" ? import_react10.default.useEffect : import_react10.default.useLayoutEffect;
28727
28864
  function toReactDrawerProps(options, open, onOpenChange, internalOnDragChange, internalOnReleaseChange) {
28728
28865
  const { id: _id, parentId: _parentId, onDragChange, onReleaseChange, ...drawerOptions } = options;
28729
28866
  const baseProps = {
@@ -28757,7 +28894,7 @@ function VanillaNode({
28757
28894
  dataAttribute
28758
28895
  }) {
28759
28896
  const ref = import_react10.default.useRef(null);
28760
- useSafeLayoutEffect(() => {
28897
+ useSafeLayoutEffect2(() => {
28761
28898
  const element = ref.current;
28762
28899
  if (!element) {
28763
28900
  return;
@@ -28963,6 +29100,7 @@ function openAncestorChain(parentId) {
28963
29100
  openAncestorChain(nextParentId);
28964
29101
  }
28965
29102
  if (!parentRuntime.controller.getSnapshot().state.isOpen) {
29103
+ releaseHiddenFocusBeforeOpen(parentRuntime.options);
28966
29104
  parentRuntime.controller.setOpen(true);
28967
29105
  notifyOpenStateChange(parentRuntime, true);
28968
29106
  renderVanillaDrawer(parentRuntime.id);
@@ -28982,6 +29120,7 @@ function bindTriggerElement(runtime) {
28982
29120
  }
28983
29121
  const triggerElement = runtime.options.triggerElement;
28984
29122
  const handleClick = () => {
29123
+ releaseHiddenFocusBeforeOpen(runtime.options);
28985
29124
  runtime.controller.setOpen(true);
28986
29125
  renderVanillaDrawer(runtime.id);
28987
29126
  };
@@ -29017,6 +29156,16 @@ function notifyOpenStateChange(runtime, open) {
29017
29156
  function canUseDOM3() {
29018
29157
  return typeof window !== "undefined" && typeof document !== "undefined";
29019
29158
  }
29159
+ function releaseHiddenFocusBeforeOpen(options) {
29160
+ if (!canUseDOM3() || options.modal === false || options.autoFocus) {
29161
+ return;
29162
+ }
29163
+ const activeElement = document.activeElement;
29164
+ if (!activeElement || activeElement === document.body || typeof activeElement.blur !== "function") {
29165
+ return;
29166
+ }
29167
+ activeElement.blur();
29168
+ }
29020
29169
  function getRuntimeDrawerElement(runtime) {
29021
29170
  if (!runtime.element) {
29022
29171
  return null;
@@ -29070,6 +29219,9 @@ function renderVanillaDrawer(id) {
29070
29219
  open: snapshot.state.isOpen,
29071
29220
  onOpenChange: (open) => {
29072
29221
  const previousOpen = runtime.controller.getSnapshot().state.isOpen;
29222
+ if (open) {
29223
+ releaseHiddenFocusBeforeOpen(runtime.options);
29224
+ }
29073
29225
  runtime.controller.setOpen(open);
29074
29226
  if (previousOpen !== open) {
29075
29227
  notifyOpenStateChange(runtime, open);
@@ -29116,6 +29268,9 @@ function buildVanillaController(id) {
29116
29268
  if (!runtime) {
29117
29269
  return createDrawer({ id, open }).getSnapshot();
29118
29270
  }
29271
+ if (open) {
29272
+ releaseHiddenFocusBeforeOpen(runtime.options);
29273
+ }
29119
29274
  const previousOpen = runtime.controller.getSnapshot().state.isOpen;
29120
29275
  const snapshot = runtime.controller.setOpen(open);
29121
29276
  if (previousOpen !== open) {
@@ -29186,6 +29341,9 @@ function createDrawer(options = {}) {
29186
29341
  notifyOpenStateChange(existing, snapshot.state.isOpen);
29187
29342
  }
29188
29343
  }
29344
+ if (nextOptions.open && !previousOpen) {
29345
+ releaseHiddenFocusBeforeOpen(nextOptions);
29346
+ }
29189
29347
  renderVanillaDrawer(id);
29190
29348
  if (nextOptions.parentId && nextOptions.open) {
29191
29349
  openAncestorChain(nextOptions.parentId);