@pluralsight/react-utils
Advanced tools
Comparing version 0.1.0-experimental-176dbe-20220831 to 0.1.0-experimental-287fdc-20220906
@@ -9,4 +9,3 @@ "use strict"; | ||
const getFocusItems = (0, react_1.useCallback)(() => { | ||
var _a, _b; | ||
const focusableItems = (_b = (_a = modalRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll(selectorList)) !== null && _b !== void 0 ? _b : []; | ||
const focusableItems = modalRef.current?.querySelectorAll(selectorList) ?? []; | ||
return { | ||
@@ -35,3 +34,3 @@ firstItem: focusableItems[0], | ||
} | ||
}, [getFocusItems, modalRef]); | ||
}, [getFocusItems]); | ||
const handleInitFocusTrap = (0, react_1.useCallback)(() => { | ||
@@ -47,6 +46,6 @@ document.body.setAttribute('data-modal-open', 'true'); | ||
(0, react_1.useEffect)(() => { | ||
const trigger = triggerRef.current; | ||
return () => { | ||
var _a; | ||
document.body.removeAttribute('data-modal-open'); | ||
(_a = triggerRef.current) === null || _a === void 0 ? void 0 : _a.focus(); | ||
trigger?.focus(); | ||
}; | ||
@@ -53,0 +52,0 @@ }, [triggerRef]); |
{ | ||
"name": "@pluralsight/react-utils", | ||
"version": "0.1.0-experimental-176dbe-20220831", | ||
"version": "0.1.0-experimental-287fdc-20220906", | ||
"description": "A set of React custom hooks for Pluralsight.", | ||
@@ -5,0 +5,0 @@ "main": "build/index.js", |
6496
94