Skip to content

Commit 367bccd

Browse files
fix(overlay): fix to support filtor-dialog of efx-grid (#1293)
* feat(overlay): add zIndex type to include auto * fix(overlay): change zIndex type from number to string * Add click event to focus on text field * Add click handler to input wrapper for focus * Update zindex-manager.ts * Refine zIndex property type definition Updated zIndex property type to remove 'auto' option. * fix(overlay): fix to support filtor-dialog of efx-grid * Update close-manager.ts
1 parent 3e0feaf commit 367bccd

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

packages/elements/src/overlay/managers/close-manager.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,14 @@ type OverlayClose = {
99
closeCallback: CloseCallback;
1010
};
1111

12+
/**
13+
* Check if an element is filter-dialog of efx-grid.
14+
* @returns {boolean} true if the element is filter-dialog
15+
*/
16+
const isFilterDialog = (elements: EventTarget) => {
17+
return elements instanceof HTMLElement && elements.tagName === 'FILTER-DIALOG';
18+
};
19+
1220
/**
1321
* Close manager ensures that the correct (or the most top) overlay
1422
* is closed on ESC and click events
@@ -84,12 +92,14 @@ export class CloseManager {
8492
const path = event.composedPath();
8593
const focusBoundary = overlay.focusBoundary || overlay;
8694
const isOutsideClick = !path.includes(focusBoundary);
95+
const isInPopup = path.find(isFilterDialog); // Ignore clicks inside filter-dialog of efx-grid
96+
const shouldClose = isOutsideClick && !isInPopup;
8797

88-
if (isOutsideClick && !overlay.noInteractionLock) {
98+
if (shouldClose && !overlay.noInteractionLock) {
8999
event.preventDefault();
90100
}
91101

92-
if (isOutsideClick && !overlay.noCancelOnOutsideClick) {
102+
if (shouldClose && !overlay.noCancelOnOutsideClick) {
93103
closeCallback();
94104
}
95105
};

0 commit comments

Comments
 (0)