Skip to content

Commit 5d58b69

Browse files
committed
fix(VTooltip): disable transition when transition=false
fixes #21268
1 parent 050d544 commit 5d58b69

File tree

4 files changed

+25
-21
lines changed

4 files changed

+25
-21
lines changed

packages/vuetify/src/components/VDialog/VDialog.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import { mergeProps, nextTick, onBeforeUnmount, ref, watch } from 'vue'
1717
import { focusableChildren, genericComponent, IN_BROWSER, propsFactory, useRender } from '@/util'
1818

1919
// Types
20-
import type { Component } from 'vue'
2120
import type { OverlaySlots } from '@/components/VOverlay/VOverlay'
2221

2322
export const makeVDialogProps = propsFactory({
@@ -31,7 +30,7 @@ export const makeVDialogProps = propsFactory({
3130
...makeVOverlayProps({
3231
origin: 'center center' as const,
3332
scrollStrategy: 'block' as const,
34-
transition: { component: VDialogTransition as Component },
33+
transition: { component: VDialogTransition },
3534
zIndex: 2400,
3635
}),
3736
}, 'VDialog')

packages/vuetify/src/components/VMenu/VMenu.tsx

+1-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ import {
4141
} from '@/util'
4242

4343
// Types
44-
import type { Component } from 'vue'
4544
import type { OverlaySlots } from '@/components/VOverlay/VOverlay'
4645

4746
export const makeVMenuProps = propsFactory({
@@ -58,7 +57,7 @@ export const makeVMenuProps = propsFactory({
5857
openDelay: 300,
5958
scrim: false,
6059
scrollStrategy: 'reposition' as const,
61-
transition: { component: VDialogTransition as Component },
60+
transition: { component: VDialogTransition },
6261
}), ['absolute']),
6362
}, 'VMenu')
6463

packages/vuetify/src/components/VTooltip/VTooltip.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const makeVTooltipProps = propsFactory({
3535
origin: 'auto' as const,
3636
scrim: false,
3737
scrollStrategy: 'reposition' as const,
38-
transition: false,
38+
transition: null,
3939
}), [
4040
'absolute',
4141
'persistent',
@@ -77,7 +77,7 @@ export const VTooltip = genericComponent<OverlaySlots>()({
7777
})
7878

7979
const transition = toRef(() => {
80-
if (props.transition) return props.transition
80+
if (props.transition != null) return props.transition
8181
return isActive.value ? 'scale-transition' : 'fade-transition'
8282
})
8383

+21-15
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
// Utilities
22
import { h, mergeProps, Transition, TransitionGroup } from 'vue'
3-
import { propsFactory } from '@/util'
3+
import { isObject, propsFactory } from '@/util'
44

55
// Types
6-
import type { Component, FunctionalComponent, PropType, TransitionProps } from 'vue'
6+
import type { Component, FunctionalComponent, Prop, TransitionProps } from 'vue'
77

88
export const makeTransitionProps = propsFactory({
99
transition: {
10-
type: [Boolean, String, Object] as PropType<string | boolean | TransitionProps & { component?: Component }>,
10+
type: null,
1111
default: 'fade-transition',
1212
validator: val => val !== true,
13-
},
13+
} as Prop<null | string | boolean | TransitionProps & { component?: Component }>,
1414
}, 'transition')
1515

1616
interface MaybeTransitionProps extends TransitionProps {
17-
transition?: string | boolean | TransitionProps & { component?: any }
17+
transition?: null | string | boolean | TransitionProps & { component?: any }
1818
disabled?: boolean
1919
group?: boolean
2020
}
@@ -25,19 +25,25 @@ export const MaybeTransition: FunctionalComponent<MaybeTransitionProps> = (props
2525
const {
2626
component = group ? TransitionGroup : Transition,
2727
...customProps
28-
} = typeof transition === 'object' ? transition : {}
28+
} = isObject(transition) ? transition : {}
29+
30+
let transitionProps
31+
if (isObject(transition)) {
32+
transitionProps = mergeProps(
33+
customProps,
34+
JSON.parse(JSON.stringify({ disabled, group })),
35+
rest,
36+
)
37+
} else {
38+
transitionProps = mergeProps(
39+
{ name: disabled || !transition ? '' : transition },
40+
rest,
41+
)
42+
}
2943

3044
return h(
3145
component,
32-
mergeProps(
33-
typeof transition === 'string'
34-
? { name: disabled ? '' : transition }
35-
: customProps as any,
36-
typeof transition === 'string'
37-
? {}
38-
: Object.fromEntries(Object.entries({ disabled, group }).filter(([_, v]) => v !== undefined)),
39-
rest as any,
40-
),
46+
transitionProps,
4147
slots
4248
)
4349
}

0 commit comments

Comments
 (0)