vuetify icon indicating copy to clipboard operation
vuetify copied to clipboard

[Bug Report] V-Dialog closes before it can be caught

Open jonperryxlm opened this issue 8 years ago • 3 comments

Versions and Environment

Vuetify: 1.2.8 Vue: 2.5.16 Browsers: Chrome 69.0.3497.100 OS: Mac OS 10.13.6

Steps to reproduce

  • Click the Open button.
  • Click outside the dialog (this will open the "Are you sure dialog")

Expected Behavior

The original dialog should remain open until the user says they are sure they want to close the original dialog

Actual Behavior

The original dialog closes as soon as the user clicks the overlay

Reproduction Link

https://codepen.io/jonperry/pen/wQKBQq

Other comments

I believe this happens because the Toggleable mixin used by Vuetify provides a variable called isActive which is updated when the value prop is updated and emits 'input' when isActive is updated. This leaves the two variables with inconsistent values when isActive is updated by the v-dialog component and that 'input' event is caught by the calling component as in the codepen example (isActive = false, value = true).

It would seem that isActive should be a computed as follows:

isActive: {
    get () {
        return this.value;
    },
    set (val) {
        this.$emit('input', val);
    }
}

jonperryxlm avatar Nov 06 '18 15:11 jonperryxlm

Are you saying that the first dialog should stay open while the second dialog opens up? I think the dialog component is designed to open one at a time.

rkomiyama avatar Nov 08 '18 14:11 rkomiyama

Thanks for the response!..

Yes, in our scenario the first dialog is almost fullscreen (spare for a gap on the left hand side) and contains a form. So when the user clicks the overlay on the left, we want to notify them if they have unsaved changes. This could either be with a dialog or toast notification.

Either way, the original dialog will already be closed before the second dialog or toast can be displayed. This happens because when the parent component is notified of the "input" event of false, the dialog component has already closed itself. To me, that's the child component controlling the parent state and goes against the purpose of v-model.

jonperryxlm avatar Nov 08 '18 14:11 jonperryxlm

No @rkomiyama, you can have many dialogs/menus opened at a time

jacekkarczmarczyk avatar Nov 08 '18 14:11 jacekkarczmarczyk