Skip to content

Commit 045362e

Browse files
Haviles04J-Sek
andauthored
fix(v-tooltip): prevent showing empty tooltip (#22347)
Co-authored-by: J-Sek <[email protected]> fixes #22345
1 parent b0ea2d3 commit 045362e

File tree

1 file changed

+8
-1
lines changed
  • packages/vuetify/src/directives/tooltip

1 file changed

+8
-1
lines changed

packages/vuetify/src/directives/tooltip/index.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import { VTooltip } from '@/components/VTooltip'
44
// Composables
55
import { useDirectiveComponent } from '@/composables/directiveComponent'
66

7+
// Utilities
8+
import { isObject } from '@/util'
9+
710
// Types
811
import type { DirectiveBinding } from 'vue'
912
import type { Anchor } from '@/util'
@@ -14,8 +17,12 @@ export interface TooltipDirectiveBinding extends Omit<DirectiveBinding<string>,
1417
}
1518

1619
export const Tooltip = useDirectiveComponent<TooltipDirectiveBinding>(VTooltip, binding => {
20+
const disabled = isObject(binding.value)
21+
? !binding.value.text
22+
: ['', false, null].includes(binding.value) // undefined means true
23+
1724
return {
18-
activator: 'parent',
25+
activator: disabled ? null : 'parent',
1926
location: binding.arg?.replace('-', ' '),
2027
text: typeof binding.value === 'boolean' ? undefined : binding.value,
2128
}

0 commit comments

Comments
 (0)