@deque/cauldron-react 7.5.0-canary.68d744a5 → 7.5.0-canary.6c7ee3b6

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.
Files changed (2) hide show
  1. package/lib/index.js +35 -2
  2. package/package.json +2 -2
package/lib/index.js CHANGED
@@ -1886,6 +1886,12 @@ var preventTopOverflowMiddleware = {
1886
1886
  });
1887
1887
  }
1888
1888
  };
1889
+ // Element-resize tracking is split out of `whileElementsMounted` so it can be
1890
+ // scoped to the open state. This function's identity must stay stable:
1891
+ // floating-ui keys its positioning effect on whether one was passed, and a
1892
+ // re-run calls `update()` again, which on close pulls focus back out of the
1893
+ // trigger.
1894
+ var autoUpdateWithoutElementResize = function (reference, floating, update) { return dom.autoUpdate(reference, floating, update, { elementResize: false }); };
1889
1895
  var AnchoredOverlay = React.forwardRef(function (_a, refProp) {
1890
1896
  var _b, _c;
1891
1897
  var as = _a.as, _d = _a.placement, initialPlacement = _d === void 0 ? 'auto' : _d, target = _a.target, children = _a.children, style = _a.style, _e = _a.open, open = _e === void 0 ? false : _e, offset = _a.offset, focusTrap = _a.focusTrap, focusTrapOptions = _a.focusTrapOptions, onOpenChange = _a.onOpenChange, onPlacementChange = _a.onPlacementChange, onShiftChange = _a.onShiftChange, portal = _a.portal, props = tslib.__rest(_a, ["as", "placement", "target", "children", "style", "open", "offset", "focusTrap", "focusTrapOptions", "onOpenChange", "onPlacementChange", "onShiftChange", "portal"]);
@@ -1914,8 +1920,35 @@ var AnchoredOverlay = React.forwardRef(function (_a, refProp) {
1914
1920
  elements: {
1915
1921
  reference: resolveElement(target)
1916
1922
  },
1917
- whileElementsMounted: dom.autoUpdate
1918
- }), refs = _f.refs, floatingStyles = _f.floatingStyles, placement = _f.placement, middlewareData = _f.middlewareData;
1923
+ whileElementsMounted: autoUpdateWithoutElementResize
1924
+ }), refs = _f.refs, floatingStyles = _f.floatingStyles, placement = _f.placement, middlewareData = _f.middlewareData, update = _f.update, elements = _f.elements;
1925
+ // Observing the target while the overlay is closed measures it for the
1926
+ // first time mid-layout, which leaves a ResizeObserver notification
1927
+ // undelivered and has the browser report an uncaught error.
1928
+ React.useEffect(function () {
1929
+ var reference = elements.reference, floating = elements.floating;
1930
+ if (!open ||
1931
+ !reference ||
1932
+ !floating ||
1933
+ typeof ResizeObserver !== 'function') {
1934
+ return;
1935
+ }
1936
+ // Deferred a task: starting it re-positions, and a render in the middle
1937
+ // of the open sequence loses the overlay's initial focus target.
1938
+ var stopObserving;
1939
+ var timeout = setTimeout(function () {
1940
+ stopObserving = dom.autoUpdate(reference, floating, update, {
1941
+ ancestorScroll: false,
1942
+ ancestorResize: false,
1943
+ layoutShift: false,
1944
+ elementResize: true
1945
+ });
1946
+ });
1947
+ return function () {
1948
+ clearTimeout(timeout);
1949
+ stopObserving === null || stopObserving === void 0 ? void 0 : stopObserving();
1950
+ };
1951
+ }, [open, elements, update]);
1919
1952
  useEscapeKey({
1920
1953
  active: open,
1921
1954
  capture: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "7.5.0-canary.68d744a5",
3
+ "version": "7.5.0-canary.6c7ee3b6",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Fully accessible react components library for Deque Cauldron",
6
6
  "homepage": "https://cauldron.dequelabs.com/",
@@ -19,7 +19,7 @@
19
19
  "classnames": "^2.2.6",
20
20
  "focusable": "^2.3.0",
21
21
  "keyname": "^0.1.0",
22
- "react-aria-components": "^1.13.0",
22
+ "react-aria-components": "^1.19.0",
23
23
  "react-id-generator": "^3.0.1",
24
24
  "react-syntax-highlighter": "^16.1.1",
25
25
  "tslib": "^2.4.0"