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

[Bug Report] v-tooltip and v-dialog activator element is removed on beforeDestroy, creating a disorienting effect #7422

Closed
rlindskog opened this issue Jun 6, 2019 · 8 comments
Assignees
Labels
C: VDialog VDialog C: VMenu VMenu C: VTooltip VTooltip T: bug Functionality that does not work as intended/expected
Milestone

Comments

@rlindskog
Copy link

Versions and Environment

Vuetify: 1.5.14
Vue: 2.6.10
Browsers: Chrome 74.0.3729.169
OS: Mac OS 10.14.4

Steps to reproduce

Create a v-tooltip and change routes away from the component.

Expected Behavior

The activator element should get destroyed at the same time as every other element

Actual Behavior

The element is destroyed before the rest of the elements

Reproduction Link

https://codesandbox.io/s/codesandboxnuxt-e992r

Other comments

This is especially noticeable when transitioning to pages with a lot of elements (news feeds, images, etc)

@ghost ghost added the S: triage label Jun 6, 2019
@KaelWD KaelWD added C: VMenu VMenu T: bug Functionality that does not work as intended/expected C: VDialog VDialog C: VTooltip VTooltip and removed S: triage labels Jun 19, 2019
@filipwronski
Copy link

I have the same problem with v-bottom-sheet activator button

@mrjackwills
Copy link

mrjackwills commented Aug 27, 2019

I am having the same, or a very similar issue, with a date picker text field.

I have a fade transition applied to router-view, and during the transition from a page with a date-picker text-field, the text field disappear.

Please see this code pen for a basic example, the transition has been slowed down to one second so that one can clearly see the text-field disappearing during the router-view transition.

Simply go to the text-field route, then click the home button to navigate back to the home page.

https://codepen.io/mrjw/pen/XWrRZWv

@johnleider
Copy link
Member

This is unfortunately not something we can solve. You can assign an arbitrary length of a transition but detachable still needs to destroy the element and it doesn't know how long that is.

As I feel there is no meaningful fix that we could provide, I'm going to close this issue. If you come up with an adjustment that makes this viable, feel free to create a PR. Thank you!

If you have any additional questions, please reach out to us in our Discord community.

@johnleider johnleider removed the T: bug Functionality that does not work as intended/expected label Sep 5, 2019
@KaelWD
Copy link
Member

KaelWD commented Sep 18, 2019

I'm having this problem too, but without a transition - v-if/v-else on an element with and without the tooltip overlap:
Peek 2019-09-18 16-33

@KaelWD KaelWD reopened this Sep 18, 2019
@KaelWD KaelWD added the T: bug Functionality that does not work as intended/expected label Sep 18, 2019
@KaelWD KaelWD self-assigned this Sep 18, 2019
@alfredo-baquedano
Copy link

Same problem here, I can't use a transitions between elements with tooltips.

https://codepen.io/alfredo-baquedano-campos/pen/YzKBKJo

@Vercadium
Copy link

Vercadium commented Jan 14, 2020

For now, using the activator prop rather than the activator slot can avoid many of the symptoms of this issue (broken transitions etc). For example:

From:

<v-menu>
  <template v-slot:activator="{ on }">
    <v-btn v-on="on">Change</v-btn>
  </template>
  <!-- Content -->
</v-menu>

To:

<v-btn id="change-button">Change</v-btn>

<v-menu activator="#change-button">
  <!-- Content -->
</v-menu>

@dyurkavets
Copy link

dyurkavets commented Sep 29, 2020

Hi, I've found a way to fix this effect on beforeDestroy hook for vuetify@2.x (the same way can be fixed for vuetify@1.5.x, but with a little bit more efforts to override render logic):

import Vue from 'vue'

import VDialog from 'vuetify/lib/components/VDialog'
import VMenu from 'vuetify/lib/components/VMenu'
import VTooltip from 'vuetify/lib/components/VTooltip'

const fix = (Component, inlineClassName = 'd-inline') => ({
    extends: Component,
    methods: {
        genActivator() {
            const activatorNode = Component.options.methods.genActivator.call(this)
            this.activatorNode = []
            return activatorNode
        }
    },
    render(h) {
        const vnode = Component.options.render.call(this, h)
        vnode.data.class[inlineClassName] = true
        return vnode
    }
})

// override
Vue.component('v-dialog', fix(VDialog, 'v-dialog__container--attached'))
Vue.component('v-menu', fix(VMenu, 'v-menu--attached'))
Vue.component('v-tooltip', fix(VTooltip, 'v-tooltip--attached'))

// or define separate components and use them in places where you want to avoid this disappearing effect
Vue.component('v-dialog-inline', fix(VDialog, 'v-dialog__container--attached'))
Vue.component('v-menu-inline', fix(VMenu, 'v-menu--attached'))
Vue.component('v-tooltip-inline', fix(VTooltip, 'v-tooltip--attached'))
<template>
    <v-container>
        <v-dialog-inline>
            <template #activator="{ on: menu }">
                <v-tooltip-inline top>
                    <template #activator="{ on: tooltip }">
                        <v-btn v-on="{ ...tooltip, ...menu }">dialog</v-btn>
                    </template>
                    <span>Tooltip</span>
                </v-tooltip>
            </template>
            <v-card>
                <v-card-title>Title</v-card-title>
                <v-card-text>Text</v-card-text>
            </v-card>
        </v-dialog>
        <v-menu-inline offset-y>
            <template #activator="{ on: menu }">
                <v-tooltip-inline top>
                    <template #activator="{ on: tooltip }">
                        <v-btn v-on="{ ...tooltip, ...menu }">menu</v-btn>
                    </template>
                    <span>Tooltip</span>
                </v-tooltip>
            </template>
            <v-list>
                <v-list-item v-for="i in 10" :key="i">List item {{ i }}</v-list-item>
            </v-list>
        </v-menu>
    </v-container>
</template>

francoispluchino added a commit to klipperdev/bow that referenced this issue Oct 5, 2020
Because content in activators is destroyed before the out transitions

See vuetifyjs/vuetify#7422
francoispluchino added a commit to klipperdev/bow that referenced this issue Oct 5, 2020
Because content in activators is destroyed before the out transitions

See vuetifyjs/vuetify#7422
@KaelWD KaelWD added this to the v3.0.0 milestone May 20, 2021
KaelWD added a commit that referenced this issue May 26, 2021
Closes #1068
Closes #4807 (class now applies to the root teleported element)
Fixes #6425
Closes #6764
Fixes #7422
Closes #8105
Closes #9595
Fixes #9632
Fixes #11263
@KaelWD KaelWD closed this as completed May 26, 2021
@KaelWD KaelWD modified the milestones: v3.0.0, v2.5.x Oct 21, 2021
@KaelWD KaelWD reopened this Oct 21, 2021
@KaelWD
Copy link
Member

KaelWD commented Oct 21, 2021

Reference:
vuejs/vue#6983
#6568

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VDialog VDialog C: VMenu VMenu C: VTooltip VTooltip T: bug Functionality that does not work as intended/expected
Projects
None yet
Development

No branches or pull requests

8 participants