Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(tooltip): prevent closing of Esc-key-closing parent components wh…
…en dismissing a tooltip with Esc (#6343) **Related Issue:** #6292 ## Summary This updates tooltip manager to cancel the Esc key press if handled to prevent closing parent components that also close with Esc. Additionally, extracts a utility to get the tooltip's effective reference element.
- Loading branch information
Showing
4 changed files
with
57 additions
and
17 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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { ReferenceElement } from "../../utils/floating-ui"; | ||
import { queryElementRoots } from "../../utils/dom"; | ||
|
||
export function getEffectiveReferenceElement(tooltip: HTMLCalciteTooltipElement): ReferenceElement { | ||
const { referenceElement } = tooltip; | ||
|
||
return ( | ||
(typeof referenceElement === "string" ? queryElementRoots(tooltip, { id: referenceElement }) : referenceElement) || | ||
null | ||
); | ||
} |