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] Dialog is closed by clicking on Snackbar #7310

Closed
jloewe opened this issue May 28, 2019 · 30 comments
Closed

[Bug Report] Dialog is closed by clicking on Snackbar #7310

jloewe opened this issue May 28, 2019 · 30 comments
Labels
C: VDialog VDialog has workaround T: bug Functionality that does not work as intended/expected

Comments

@jloewe
Copy link

jloewe commented May 28, 2019

Versions and Environment

Vuetify: 1.5.14
Vue: 2.6.10
Browsers: Chrome 74.0.3729.108
OS: Windows 10

Steps to reproduce

  1. Open Dialog
  2. Close Snackbar

Expected Behavior

Only Snackbar closes

Actual Behavior

Dialog and Snackbar close

Reproduction Link

R79d31JbjO

https://codepen.io/jloewe/pen/dEjGMw (v1.5.14)
https://codepen.io/jloewe/pen/ZNjQrr (v2.0.0-alpha.20)

@ghost ghost added the S: triage label May 28, 2019
@KaelWD KaelWD added C: VDialog VDialog P: low The issue is of low importance T: bug Functionality that does not work as intended/expected and removed S: triage labels May 28, 2019
@KaelWD
Copy link
Member

KaelWD commented May 28, 2019

Workaround is to add persistent to the dialog.

@jacekkarczmarczyk
Copy link
Member

It happens also in normal (not fullscreen) dialogs https://codepen.io/anon/pen/zgGLgK which makes the workaround not so great in this case

@jacekkarczmarczyk jacekkarczmarczyk removed the P: low The issue is of low importance label Jul 21, 2019
@KaelWD KaelWD changed the title [Bug Report] Fullscreen Dialog is closed by Snackbar [Bug Report] Dialog is closed by Snackbar Sep 22, 2019
@KaelWD KaelWD changed the title [Bug Report] Dialog is closed by Snackbar [Bug Report] Dialog is closed by clicking on Snackbar Sep 22, 2019
@payammeyer
Copy link

Any update on this? The workaround (persistent prop) doesn't work for me either.

@185driver
Copy link
Contributor

185driver commented Oct 16, 2019

Workaround is to add persistent to the dialog.

I'm not finding this to be true (#9378). How are you getting this to work?

I believe this bug is a regression, since the problem doesn't exist in my v1.3 project.

@payammeyer

This comment has been minimized.

@MajesticPotatoe
Copy link
Member

MajesticPotatoe commented Oct 16, 2019

@185driver there's another issue at play as well. Conflict between hide-overlay and persistent #8697
With fullscreen prop hide-overlay is assumed thus persistent wont work. on your codepen dialog, if you remove hide-overlay it works

@payammeyer

This comment has been minimized.

@185driver
Copy link
Contributor

185driver commented Oct 16, 2019

@MajesticPotatoe Thanks. Indeed, that was noted in the issue I posted. I wasn't aware that fullscreen pulled in hide-overlay functionality automatically. Good to know, and it makes sense. Actually, to me, fullscreen should naturally pull in persistent too, then, as clicking outside the dialog isn't practically possible (or shouldn't be).

@185driver

This comment has been minimized.

@payammeyer

This comment has been minimized.

@185driver
Copy link
Contributor

Bless @jacekkarczmarczyk for removing the p:low tag. Without a workaround, this issue is a pain. Ha. Thanks for all you guys do!

@MajesticPotatoe

This comment has been minimized.

@payammeyer

This comment has been minimized.

@tovikfekih
Copy link

tovikfekih commented Nov 6, 2019

I'm having the same issue here,
It seems that if the snackbar has been created inside of the dialog or outside (but still in the same component), the persistent prop does fix the problem.
But if you have the snackbar created and managed elsewhere (in Layout component for example), i'm still getting the closing trigger of any of my dialogs

@payammeyer
Copy link

@FekihTaoufik interesting observation, my snackbars are indeed created elsewhere and triggered to display via an event.

@tovikfekih
Copy link

tovikfekih commented Nov 6, 2019

It seems that anything that has a fixed position and clickable, does trigger the close:outer event of any
fullscreen dialog (even with persistent prop).

@ThomasGauthierr
Copy link

I'm facing the very same issue, any help would be greatly appreciated.

@benjauger
Copy link

benjauger commented Nov 13, 2019

Same issue here, with the dialog full screen component. The workaround by @185driver works but not with fullscreen props ... 😢

@NavidMitchell
Copy link
Contributor

NavidMitchell commented Feb 18, 2020

Found a temporary fix here that worked for me. It is not the marked answer but works nicely.

https://stackoverflow.com/questions/49627750/vuetify-closing-snackbar-without-closing-dialog

"For anyone still looking for a good solution: add <div class="v-menu__content--active" style="display:none; z-index:1000;">` as a child of your v-snackbar. This tricks v-dialog to think it was not the active component when click outside happened and prevents closing."

@185driver
Copy link
Contributor

@NavidMitchell This is a fantastic workaround. Thanks for sharing it. This issue affects my apps daily (due to snackbars with clickable buttons) so your solution is a welcome relief. I modified the markup slightly after some testing, but it works the same, in case someone is interested:

<v-snackbar
  v-model="snackbar"
  bottom
>
  <div
    v-show="false"
    class="v-menu__content--active"
  />
  {{ snackText }}
</v-snackbar>

@KaelWD
Copy link
Member

KaelWD commented Feb 18, 2020

Damn that's sneaky. Note this will cause the dialog to have a higher z-index than the snackbar if the snackbar is open first.

@185driver
Copy link
Contributor

Is the higher z-index issue alleviated by setting it to 1000 as @NavidMitchell suggested?

@KaelWD
Copy link
Member

KaelWD commented Feb 19, 2020

No, you should set z-index on the dialog instead.

@yusifk88
Copy link

yusifk88 commented Mar 7, 2020

@MajesticPotatoe Thanks. Indeed, that was noted in the issue I posted. I wasn't aware that fullscreen pulled in hide-overlay functionality automatically. Good to know, and it makes sense. Actually, to me, fullscreen should naturally pull in persistent too, then, as clicking outside the dialog isn't practically possible (or shouldn't be).

this would not be practical either, i was facing this issues and thought i could just add persist on the dialog until users started wondering why pressing escape on the keyboard dose not close the dialog, my solution now is remove the persistent from the dialog and also remove the close button from the snackbar so it timeout by it self

@185driver
Copy link
Contributor

Some observations after upgrading to v2.3.0...here's an updated codepen too:

  1. The workaround shared by @NavidMitchell no longer seems to work, at least for me. I'm not sure what the issue is, as I'm getting intermittent results in my project, but mostly my v-snackbar no longer displays properly when triggered within a fullscreen dialog. The structural changes to v-snackbar made in PR #11542 seem to be the reason.
  2. On the bright side, the workaround is no longer needed if you add the persistent prop to v-dialog. This was the original workaround that didn't work in some cases. Now it does, but it comes with a side effect...dismissing the snackbar causes the persistent click animation to fire, which is an odd effect on a fullscreen dialog. Adding the no-click-animation prop along with the persistent prop resolves this.
  3. Earlier in this thread, there was discussion of v-dialog behavior in fullscreen or non-fullscreen mode along with hide-overlay and persistent prop use. I don't know what the current v-dialog status is for these props, but my suggestion for resolving and closing this issue would be to consider automatically adding hide-overlay, persistent and no-click-animation props (their associated classes, actually) anytime the fullscreen prop is invoked. It seems natural that they would always be included in a fullscreen scenario, and would eliminate the need to add them manually.

@albertovincenzi
Copy link

@185driver

  1. I tested and works but if dialogs are not fullscreen, the snackbar appears under, so its not fully visible
  2. Agree, its not nice to see the animation
  3. In my opinion, its not the best choice because I expect that by default, clicking on dismiss button of snackbar will only generate a single action which doesn't involve other components. Adding all that props will solve the issue but I still consider that as a workaround.

@mihailovskim
Copy link

This issue is still not resolved?

I have case where I use snackbar as notification alert, so some action is done on modal and it's closed, snackbar is shown and starting to count - closed automatically after 5sec. If in meantime any other modal is opened, it closes in the same moment when snackbar disappears and cannot be open anymore because modal v-model is not changed to false.

@MetRonnie
Copy link
Contributor

MetRonnie commented Jun 13, 2023

Repro in Vuetify 3.3.3: https://play.vuetifyjs.com/#...

@MetRonnie
Copy link
Contributor

Why has this been closed? It's still reproduceable in the latest nightly build: https://play.vuetifyjs.com/#...

@johnleider johnleider reopened this Oct 2, 2023
@johnleider
Copy link
Member

This issue references v1.5 of Vuetify. If it's still relevant in Vuetify 3, create a new issue please.

@johnleider johnleider closed this as not planned Won't fix, can't repro, duplicate, stale Oct 2, 2023
@vuetifyjs vuetifyjs locked as resolved and limited conversation to collaborators Oct 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C: VDialog VDialog has workaround T: bug Functionality that does not work as intended/expected
Projects
None yet
Development

No branches or pull requests