@deque/cauldron-react 6.25.2 → 6.25.3-canary.124879ea
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/lib/index.js +20 -6
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -5351,8 +5351,13 @@ var ActionMenu = React.forwardRef(function (_a, ref) {
|
|
|
5351
5351
|
setOpen(false);
|
|
5352
5352
|
}
|
|
5353
5353
|
}, []);
|
|
5354
|
-
var handleOverlayBlur = React.useCallback(function () {
|
|
5355
|
-
|
|
5354
|
+
var handleOverlayBlur = React.useCallback(function (event) {
|
|
5355
|
+
var _a, _b;
|
|
5356
|
+
var relatedTarget = event.relatedTarget;
|
|
5357
|
+
if (!((_a = actionMenuRef.current) === null || _a === void 0 ? void 0 : _a.contains(relatedTarget)) &&
|
|
5358
|
+
!((_b = triggerRef.current) === null || _b === void 0 ? void 0 : _b.contains(relatedTarget))) {
|
|
5359
|
+
setOpen(false);
|
|
5360
|
+
}
|
|
5356
5361
|
}, []);
|
|
5357
5362
|
var handleAction = React.useCallback(function (key, event) {
|
|
5358
5363
|
// istanbul ignore else
|
|
@@ -5365,12 +5370,21 @@ var ActionMenu = React.forwardRef(function (_a, ref) {
|
|
|
5365
5370
|
}
|
|
5366
5371
|
}, [actionMenuList.props.onAction]);
|
|
5367
5372
|
React.useEffect(function () {
|
|
5368
|
-
var _a, _b
|
|
5373
|
+
var _a, _b;
|
|
5369
5374
|
if (open) {
|
|
5370
|
-
|
|
5375
|
+
// Use double requestAnimationFrame to ensure layout is complete.
|
|
5376
|
+
// The first RAF schedules work for the next frame, the second ensures
|
|
5377
|
+
// the browser has actually completed the layout pass.
|
|
5378
|
+
// This prevents scroll jumping when opening ActionMenus.
|
|
5379
|
+
requestAnimationFrame(function () {
|
|
5380
|
+
requestAnimationFrame(function () {
|
|
5381
|
+
var _a;
|
|
5382
|
+
(_a = actionMenuListRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
5383
|
+
});
|
|
5384
|
+
});
|
|
5371
5385
|
}
|
|
5372
|
-
else if ((
|
|
5373
|
-
(
|
|
5386
|
+
else if ((_a = actionMenuListRef.current) === null || _a === void 0 ? void 0 : _a.contains(document.activeElement)) {
|
|
5387
|
+
(_b = triggerRef.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
5374
5388
|
}
|
|
5375
5389
|
}, [open]);
|
|
5376
5390
|
var hidden = renderInTrigger && !open;
|
package/package.json
CHANGED