@deque/cauldron-react 6.25.3-canary.e1e767cb → 6.25.3-canary.f19ddaa7

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 +13 -4
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -5365,12 +5365,21 @@ var ActionMenu = React.forwardRef(function (_a, ref) {
5365
5365
  }
5366
5366
  }, [actionMenuList.props.onAction]);
5367
5367
  React.useEffect(function () {
5368
- var _a, _b, _c;
5368
+ var _a, _b;
5369
5369
  if (open) {
5370
- (_a = actionMenuListRef.current) === null || _a === void 0 ? void 0 : _a.focus();
5370
+ // Use double requestAnimationFrame to ensure layout is complete.
5371
+ // The first RAF schedules work for the next frame, the second ensures
5372
+ // the browser has actually completed the layout pass.
5373
+ // This prevents scroll jumping when opening ActionMenus.
5374
+ requestAnimationFrame(function () {
5375
+ requestAnimationFrame(function () {
5376
+ var _a;
5377
+ (_a = actionMenuListRef.current) === null || _a === void 0 ? void 0 : _a.focus();
5378
+ });
5379
+ });
5371
5380
  }
5372
- else if ((_b = actionMenuListRef.current) === null || _b === void 0 ? void 0 : _b.contains(document.activeElement)) {
5373
- (_c = triggerRef.current) === null || _c === void 0 ? void 0 : _c.focus();
5381
+ else if ((_a = actionMenuListRef.current) === null || _a === void 0 ? void 0 : _a.contains(document.activeElement)) {
5382
+ (_b = triggerRef.current) === null || _b === void 0 ? void 0 : _b.focus();
5374
5383
  }
5375
5384
  }, [open]);
5376
5385
  var hidden = renderInTrigger && !open;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deque/cauldron-react",
3
- "version": "6.25.3-canary.e1e767cb",
3
+ "version": "6.25.3-canary.f19ddaa7",
4
4
  "license": "MPL-2.0",
5
5
  "description": "Fully accessible react components library for Deque Cauldron",
6
6
  "homepage": "https://cauldron.dequelabs.com/",