diff options
author | 2023-12-04 05:24:22 -0800 | |
---|---|---|
committer | 2023-12-04 14:24:22 +0100 | |
commit | 7a231e476380b2cf384c4afc20908932e3e347a4 (patch) | |
tree | 4c487b4fefc24b286de8c3357803424ce9337a1d | |
parent | feaba2c7fc0a48d3af7dd98e6b750ec1e8274e33 (diff) | |
download | astro-7a231e476380b2cf384c4afc20908932e3e347a4.tar.gz astro-7a231e476380b2cf384c4afc20908932e3e347a4.tar.zst astro-7a231e476380b2cf384c4afc20908932e3e347a4.zip |
[Toolbar] Fix tooltip overlap bug (#9283)
-rw-r--r-- | packages/astro/src/runtime/client/dev-overlay/plugins/utils/highlight.ts | 4 | ||||
-rw-r--r-- | packages/astro/src/runtime/client/dev-overlay/plugins/xray.ts | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/packages/astro/src/runtime/client/dev-overlay/plugins/utils/highlight.ts b/packages/astro/src/runtime/client/dev-overlay/plugins/utils/highlight.ts index 9dad2b0f5..73d7fe112 100644 --- a/packages/astro/src/runtime/client/dev-overlay/plugins/utils/highlight.ts +++ b/packages/astro/src/runtime/client/dev-overlay/plugins/utils/highlight.ts @@ -57,9 +57,12 @@ export function attachTooltipToHighlight( originalElement: Element ) { highlight.shadowRoot.append(tooltip); + // Track the original z-index so that we can restore it after hover + const originalZIndex = highlight.style.zIndex; (['mouseover', 'focus'] as const).forEach((event) => { highlight.addEventListener(event, () => { + highlight.style.zIndex = '9999999999'; tooltip.dataset.show = 'true'; const originalRect = originalElement.getBoundingClientRect(); const dialogRect = tooltip.getBoundingClientRect(); @@ -77,6 +80,7 @@ export function attachTooltipToHighlight( (['mouseout', 'blur'] as const).forEach((event) => { highlight.addEventListener(event, () => { tooltip.dataset.show = 'false'; + highlight.style.zIndex = originalZIndex; }); }); } diff --git a/packages/astro/src/runtime/client/dev-overlay/plugins/xray.ts b/packages/astro/src/runtime/client/dev-overlay/plugins/xray.ts index ed1be3ede..8ce16f7c4 100644 --- a/packages/astro/src/runtime/client/dev-overlay/plugins/xray.ts +++ b/packages/astro/src/runtime/client/dev-overlay/plugins/xray.ts @@ -80,7 +80,6 @@ export default { const rect = islandElement.getBoundingClientRect(); const highlight = createHighlight(rect); const tooltip = buildIslandTooltip(island); - attachTooltipToHighlight(highlight, tooltip, islandElement); // Set the z-index to be 1 higher than the greatest z-index in the stack. // And also set the highlight/tooltip as being fixed position if they are inside @@ -94,6 +93,7 @@ export default { tooltip.style.position = highlight.style.position = 'fixed'; } + attachTooltipToHighlight(highlight, tooltip, islandElement); canvas.append(highlight); islandsOverlays.push({ highlightElement: highlight, island: islandElement }); }); |