@lumx/react 3.6.7-alpha.2 → 3.6.7-alpha.3
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/index.d.ts +0 -2
- package/index.js +3 -6
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/popover/Popover.tsx +1 -5
- package/src/utils/focus/getFocusableElements.ts +1 -3
package/package.json
CHANGED
|
@@ -7,8 +7,8 @@
|
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"@juggle/resize-observer": "^3.2.0",
|
|
10
|
-
"@lumx/core": "^3.6.7-alpha.
|
|
11
|
-
"@lumx/icons": "^3.6.7-alpha.
|
|
10
|
+
"@lumx/core": "^3.6.7-alpha.3",
|
|
11
|
+
"@lumx/icons": "^3.6.7-alpha.3",
|
|
12
12
|
"@popperjs/core": "^2.5.4",
|
|
13
13
|
"body-scroll-lock": "^3.1.5",
|
|
14
14
|
"classnames": "^2.3.2",
|
|
@@ -112,5 +112,5 @@
|
|
|
112
112
|
"build:storybook": "storybook build"
|
|
113
113
|
},
|
|
114
114
|
"sideEffects": false,
|
|
115
|
-
"version": "3.6.7-alpha.
|
|
115
|
+
"version": "3.6.7-alpha.3"
|
|
116
116
|
}
|
|
@@ -60,8 +60,6 @@ export interface PopoverProps extends GenericProps, HasTheme {
|
|
|
60
60
|
placement?: Placement;
|
|
61
61
|
/** Whether the popover should be rendered into a DOM node that exists outside the DOM hierarchy of the parent component. */
|
|
62
62
|
usePortal?: boolean;
|
|
63
|
-
/** The element in which the focus trap should be set. Default to popover. */
|
|
64
|
-
focusTrapZoneElement?: RefObject<HTMLElement>;
|
|
65
63
|
/** Z-axis position. */
|
|
66
64
|
zIndex?: number;
|
|
67
65
|
/** On close callback (on click away or Escape pressed). */
|
|
@@ -117,7 +115,6 @@ const _InnerPopover: Comp<PopoverProps, HTMLDivElement> = forwardRef((props, ref
|
|
|
117
115
|
boundaryRef,
|
|
118
116
|
fitToAnchorWidth,
|
|
119
117
|
fitWithinViewportHeight,
|
|
120
|
-
focusTrapZoneElement,
|
|
121
118
|
offset,
|
|
122
119
|
placement,
|
|
123
120
|
style,
|
|
@@ -149,13 +146,12 @@ const _InnerPopover: Comp<PopoverProps, HTMLDivElement> = forwardRef((props, ref
|
|
|
149
146
|
});
|
|
150
147
|
|
|
151
148
|
const unmountSentinel = useRestoreFocusOnClose({ focusAnchorOnClose, anchorRef, parentElement }, popperElement);
|
|
152
|
-
const focusZoneElement = focusTrapZoneElement?.current || popoverRef?.current;
|
|
153
149
|
|
|
154
150
|
useCallbackOnEscape(onClose, isOpen && closeOnEscape);
|
|
155
151
|
|
|
156
152
|
/** Only set focus within if the focus trap is disabled as they interfere with one another. */
|
|
157
153
|
useFocus(focusElement?.current, !withFocusTrap && isOpen && isPositioned);
|
|
158
|
-
useFocusTrap(withFocusTrap && isOpen &&
|
|
154
|
+
useFocusTrap(withFocusTrap && isOpen && popoverRef?.current, focusElement?.current);
|
|
159
155
|
|
|
160
156
|
const clickAwayRefs = useRef([popoverRef, anchorRef]);
|
|
161
157
|
const mergedRefs = useMergeRefs<HTMLDivElement>(setPopperElement, ref, popoverRef);
|
|
@@ -3,7 +3,5 @@ import { DISABLED_SELECTOR, TABBABLE_ELEMENTS_SELECTOR } from './constants';
|
|
|
3
3
|
const isNotDisabled = (element: HTMLElement) => !element.matches(DISABLED_SELECTOR);
|
|
4
4
|
|
|
5
5
|
export function getFocusableElements(element: HTMLElement): HTMLElement[] {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return focusableElements;
|
|
6
|
+
return Array.from(element.querySelectorAll<HTMLElement>(TABBABLE_ELEMENTS_SELECTOR)).filter(isNotDisabled);
|
|
9
7
|
}
|