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
In my React app, I'm using ShadCN Sidebar. One of its menu items is a button.
When I click this button, it should open a dialog.
Currently I implemented in a way where it seems like this:
<ShadCN Sidebar Provider>
<ShadCN Sidebar>
<Dialog>
<DialogTrigger>
My button
<DialogContent>
My Dialog Content
My sidebar is managed in a way where it's default open for non mobile view. For mobile view - it's closed by default.
Hence, when I open the dialog on desktop view, then resize the window size whilst the dialog is open, the dialog will be closed when I resize to mobile view, because the sidebar element itself (which contains the dialog) - has been removed from the DOM.
ShadCN already wraps with portal so this does not help.
How can I keep the dialog open when resizing to mobile?
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.
Uh oh!
There was an error while loading. Please reload this page.
-
In my React app, I'm using ShadCN Sidebar. One of its menu items is a button.
When I click this button, it should open a dialog.
Currently I implemented in a way where it seems like this:
My sidebar is managed in a way where it's default open for non mobile view. For mobile view - it's closed by default.
Hence, when I open the dialog on desktop view, then resize the window size whilst the dialog is open, the dialog will be closed when I resize to mobile view, because the sidebar element itself (which contains the dialog) - has been removed from the DOM.
ShadCN already wraps with portal so this does not help.
How can I keep the dialog open when resizing to mobile?
Beta Was this translation helpful? Give feedback.
All reactions