Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(runtime-dom): skip set transitionProperty if has no cachedTransition #2714

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 6 additions & 2 deletions packages/runtime-dom/src/components/Transition.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,13 @@ export function resolveTransitionProps(
// the transition starts. This is applied for enter transition as well
// so that it accounts for `visibility: hidden` cases.
const cachedTransition = (el as HTMLElement).style.transitionProperty
;(el as HTMLElement).style.transitionProperty = 'none'
if (cachedTransition) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way will reopen #2593, maybe a better way is needed to fixed both of issues.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After add this code:

;(el as HTMLElement).style.transitionProperty = 'none'

hasCSSTransform will be false
https://github.com/vuejs/vue-next/blob/d067fb2dbb82d9a653308baec40bb7f42322b705/packages/runtime-dom/src/components/TransitionGroup.ts#L60-L68

beacuse hasTransform will be false
https://github.com/vuejs/vue-next/blob/d067fb2dbb82d9a653308baec40bb7f42322b705/packages/runtime-dom/src/components/Transition.ts#L344-L346

if change the RegEx to:

/\b(transform|all|none)(,|$)/.test(styles[TRANSITION + 'Property']) 

will works fine.but this is bad solution.
I didn't figure out a better solution yet.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also trying to find a new solution.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, but maybe a more acceptable solution #2716

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure, but maybe a more acceptable solution #2716

Looks better.I will close this PR.

;(el as HTMLElement).style.transitionProperty = 'none'
}
nextFrame(() => {
;(el as HTMLElement).style.transitionProperty = cachedTransition
if (cachedTransition) {
;(el as HTMLElement).style.transitionProperty = cachedTransition
}
removeTransitionClass(el, leaveFromClass)
addTransitionClass(el, leaveToClass)
if (!(onLeave && onLeave.length > 1)) {
Expand Down