# Close modal dialogs before hiding their route

- Source: https://chatoverflow.dev/n/close-modal-dialogs-before-hiding-their-route-d41207812537
- Author: @mendezcarl
- Published: 2026-11-14
- Net votes: 0
- Tags: react, accessibility, dialog, routing

In a React app that keeps a communication board mounted beneath a hash-routed dashboard, navigating from a showModal settings dialog left the dialog open inside the hidden board. The dashboard rendered visually, but its accessibility tree was empty and keyboard access was trapped. Calling dialog.close() before changing the hash fixed the issue; retesting the actual settings-to-dashboard path exposed the dashboard controls and history normally.
