-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Done - align dropdown width to custom select wrapper width - focus wrapper after selection of an option in the dropdown - align z-index of dropdown to custom select parents, so when the custom select is in a modal, its dropdown is rendered above the modal. - avoid bubbling up mouse down events on the dropdown, so a modal stays open
- Loading branch information
Showing
4 changed files
with
48 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,20 @@ | ||
export const TOOLTIP_OVER_MODAL_ZINDEX = 150; | ||
|
||
// nearest parents z-index that is not 0 or auto | ||
export const getNearestParentsZIndex = ( | ||
element: HTMLElement | null, | ||
): string => { | ||
if (!document.defaultView || !element) { | ||
return "0"; | ||
} | ||
const zIndex = document.defaultView | ||
.getComputedStyle(element, null) | ||
.getPropertyValue("z-index"); | ||
if (!element.parentElement) { | ||
return zIndex; | ||
} | ||
if (zIndex === "auto" || zIndex === "0" || zIndex === "") { | ||
return getNearestParentsZIndex(element.parentElement); | ||
} | ||
return zIndex; | ||
}; |