Skip to content

[dialog] dialog with createHandle survives navigation and preserve pre-navigation store state #4951

@oleksandrkovaliuk

Description

@oleksandrkovaliuk

Bug report

  1. Open the dialog with attached handle
  2. Unmount the dialog while open (eg in my case - by navigating away)
  3. Return to the previous screen and mount the dialog back

Current behavior

If you try to follow steps above , you will see that dialog stays with state from before navigation.

And another example is straight base-ui.com - Controlled mode with multiple triggers.
Click any detached triggers from an example , navigate away and then navigate back. You won't see opened dialog but you won't be able to do anything on the page either. Definitely something going on with store or handle state clean up.

freecompress-Screen.Recording.2026-05-23.at.1.05.10.PM.2.mp4

Expected behavior

Feels like it should properly clean-up it's current state , so it behaves how any other dialogs without handle attached.

Reproducible example

https://stackblitz.com/edit/a9jtaf9i-rxzlgxqh?file=src%2Froute-with-dialog.tsx)

Base UI version

1.5.0 - but i am pretty sure i encountered the same behaviour on other versions.

Which browser are you using?

Chrome

Which OS are you using?

Mac OS

Which assistive tech are you using (if applicable)?

Additional context

https://discord.com/channels/1287292451308048406/1507703359660884079

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: alert dialogChanges related to the alert dialog component.component: dialogChanges related to the dialog component.component: popoverChanges related to the popover component.type: bugIt doesn't behave as expected.
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions