-
Notifications
You must be signed in to change notification settings - Fork 8
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
Modal persists if hardware back button is pressed #24
Comments
There are a few ways to solve this issue. If you are using Vue Router the easiest one will be adding this code to your modal component:
So if the route changes modal will close itself |
Thanks for the suggestion! I gave it a try and it's hiding the modal now when pressing the back button. In my unit tests, I am getting the following error:
I have the following code when unit testing. Note that I am using
Do I need something additional to address the console warning? Any chance it is giving this warning because it thinks watching |
|
Also, you can try this approach:
Here we obviously declare the watching object as |
I am getting the same warning when running unit tests, so I may need to take another look there. I think for runtime purposes this solution works well, though. Thanks for the help! |
Hi,
I've created a modal setup using this library. It's been working great, but when I press the browser back button, the modal persists. I would like it to be inactive again if I press the back button.
After searching, I did come across this useful answer on using the query param. I was wondering if there was a a way to translate this behavior to this library. For my current use case, I would like to provide a one-time code to the modal, and that code should go away if I press the browser back button or refresh the page (it works for the latter, but not the former).
Please let me know if there's a way to do so, or if it's something that you would be able to develop in the future.
The text was updated successfully, but these errors were encountered: