Skip to content

Commit 6b8b10c

Browse files
committed
fix(ui): tooltip z index and positioning
1 parent abf5521 commit 6b8b10c

4 files changed

Lines changed: 15 additions & 3 deletions

File tree

app/components/Package/VersionDistribution.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@ const xAxisLabels = computed(() => {
247247
v-model="hideSmallVersions"
248248
:label="$t('package.versions.hide_old_versions')"
249249
:tooltip="$t('package.versions.hide_old_versions_tooltip')"
250-
tooltip-position="top"
250+
tooltip-position="right"
251+
:tooltip-teleport-to="inModal ? '#chart-modal' : undefined"
251252
:class="{ 'opacity-50 pointer-events-none': pending }"
252253
/>
253254
</div>

app/components/Settings/Toggle.client.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ defineProps<{
66
description?: string
77
tooltip?: string
88
tooltipPosition?: 'top' | 'bottom' | 'left' | 'right'
9+
tooltipTeleportTo?: string
910
class?: string | Record<string, boolean> | Array<string | Record<string, boolean>>
1011
}>()
1112
@@ -23,7 +24,12 @@ const checked = defineModel<boolean>({
2324
@click="checked = !checked"
2425
:class="class"
2526
>
26-
<TooltipApp v-if="tooltip && label" :text="tooltip" :position="tooltipPosition ?? 'top'">
27+
<TooltipApp
28+
v-if="tooltip && label"
29+
:text="tooltip"
30+
:position="tooltipPosition ?? 'top'"
31+
:teleportTo="tooltipTeleportTo"
32+
>
2733
<span class="text-sm font-mono text-fg group-hover:text-fg/80 transition-colors select-none">
2834
{{ label }}
2935
</span>

app/components/Tooltip/App.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ const props = defineProps<{
66
position?: 'top' | 'bottom' | 'left' | 'right'
77
/** Enable interactive tooltip (pointer events + hide delay for clickable content) */
88
interactive?: boolean
9+
/** Teleport target selector (defaults to 'body') */
10+
teleportTo?: string
911
}>()
1012
1113
const isVisible = shallowRef(false)
@@ -47,6 +49,7 @@ const tooltipAttrs = computed(() => {
4749
:isVisible
4850
:position
4951
:interactive
52+
:teleportTo
5053
:tooltip-attr="tooltipAttrs"
5154
@mouseenter="show"
5255
@mouseleave="hide"

app/components/Tooltip/Base.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ const props = defineProps<{
1414
interactive?: boolean
1515
/** attributes for tooltip element */
1616
tooltipAttr?: HTMLAttributes
17+
/** Teleport target selector (defaults to 'body') */
18+
teleportTo?: string
1719
}>()
1820
1921
const triggerRef = useTemplateRef('triggerRef')
@@ -32,7 +34,7 @@ const { floatingStyles } = useFloating(triggerRef, tooltipRef, {
3234
<div ref="triggerRef" class="inline-flex">
3335
<slot />
3436

35-
<Teleport to="body">
37+
<Teleport :to="teleportTo ?? 'body'">
3638
<Transition
3739
enter-active-class="transition-opacity duration-150 motion-reduce:transition-none"
3840
leave-active-class="transition-opacity duration-100 motion-reduce:transition-none"

0 commit comments

Comments
 (0)