You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to use a Radix Dialog with react-router, and mount the Dialog at a specified route. Ideally it would be great if I could just do something like this:
However, this isn't really possible because the Dialog component needs to wrap both the trigger and the content, in order to return focus to the trigger when the Dialog closes (this is important and I want to keep this functionality). With the set up above, that would mean the trigger also only gets rendered when the route is matched.
I was wondering if anyone has implemented something similar to this, or has any ideas about how best to handle it? Currently I am getting around this by checking the location.pathname inside the Dialog and setting the open state based on whether the string matches /dialog-route but this doesn't feel like a very robust implementation.
Any help or ideas would be really appreciated. Thanks!
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I would like to use a Radix Dialog with
react-router
, and mount the Dialog at a specified route. Ideally it would be great if I could just do something like this:However, this isn't really possible because the Dialog component needs to wrap both the trigger and the content, in order to return focus to the trigger when the Dialog closes (this is important and I want to keep this functionality). With the set up above, that would mean the trigger also only gets rendered when the route is matched.
I was wondering if anyone has implemented something similar to this, or has any ideas about how best to handle it? Currently I am getting around this by checking the
location.pathname
inside the Dialog and setting the open state based on whether the string matches/dialog-route
but this doesn't feel like a very robust implementation.Any help or ideas would be really appreciated. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions