Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const FloatingPopoverComponent = defineComponent({
)

let previousContent: VNode | undefined
let previousStyle: Record<string, string> = {}

return () => {
// Force re-render to update the position
Expand All @@ -62,6 +63,23 @@ const FloatingPopoverComponent = defineComponent({
if (!el.value)
return null

// When dismissing (item is null), keep the last known position
// so the popover fades out in place instead of jumping
if (!props.item) {
return h(
'div',
{
ref: 'panel',
class: [
'fixed z-floating-tooltip text-xs transition-all duration-300 w-max bg-glass color-base border border-base rounded px2 p1',
'op0 pointer-events-none',
],
style: previousStyle,
},
previousContent,
)
}

const rect = el.value.getBoundingClientRect()

// guess alignment of the tooltip based on viewport position
Expand Down Expand Up @@ -116,6 +134,8 @@ const FloatingPopoverComponent = defineComponent({
}
}

previousStyle = style

const content = (
typeof props.item?.content === 'string'
? h('span', props.item?.content)
Expand Down
Loading