-
Notifications
You must be signed in to change notification settings - Fork 956
Description
Package
v4.x
Description
When using fullscreen or blocking modals, browser back navigation can still be triggered and causes unexpected routing behavior. Ideally, modal overlays should take priority over navigation actions.
Problem
In our application, users can navigate using the browser’s back button even when one or more modals are open. With fullscreen modals this leads to confusing UX: instead of closing the modal, Nuxt Router navigates back to the previous page, leaving the modal open or causing layout glitches.
We attempted to manage this manually, but the useOverlays composable currently does not expose an API to:
- Determine whether the topmost modal is dismissable
Because of this, implementing consistent behavior is difficult.
Expected behavior
- When the browser back button is pressed and a dismissable modal is open, Nuxt UI should dismiss the modal instead of changing the route.
- When a non-dismissable modal is open, the router should not navigate back at all.
- Developers should be able to introspect active overlays (stack, modal types, dismissability, etc.) via useOverlays or a similar API.
Feature request
Please extend useOverlays or provide a new API that supports:
- Access to the list/stack of currently active modals
- Ability to check whether the top modal is dismissable
- Ability to dismiss modals programmatically
- A built-in mechanism or helper to intercept browser navigation and apply modal-first behavior
I think, that Point 1 and 3 is already there, but I could not find a way to check if the modal is dismissable and the forth point would be a dream.
Additional context
No response