-
-
Notifications
You must be signed in to change notification settings - Fork 341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dialog/Drawer issues with controlled state #624
Comments
I can reproduce the |
Similar issue happens when Screen.Recording.2024-01-15.at.19.15.08.mov |
There is a similar issue when creating a toast when a Dialog.mp4drawer.mp4 |
I got the drawer drag work when first opened by wrapping the form in a div and giving it a height of 1/2 |
This is because it considers the toast to be an "outside click" event, and closes the drawer on those events. You can use the For example, if all of your toasts had a common <script lang="ts">
// let's say all of our toasts have a `data-toast` attribute
function onOutsideClick(event: PointerEvent) {
if (event.target && event.target.hasAttribute("data-toast") {
event.preventDefault()
}
};
</script>
<Drawer.Root {onOutsideClick}>
<!-- ... -->
</Drawer.Root> By calling Will make a note to document this a bit better! |
My case was fixed with: bits-ui ^0.15.1 → ^0.16.0
vaul-svelte ^0.1.0 → ^0.2.1 Thank you. |
Issue is back again with: bits-ui ^0.16.0 → ^0.17.0 :) |
Similar issue here. The selection of a Update: I use this to fix it: onOutsideClick={(e) => {
if (e.target && e.target instanceof HTMLElement && e.target.hasAttribute('data-select-item')) {
e.preventDefault();
}
}} Reproduction: https://stackblitz.com/edit/github-6lpr3i?file=src%2Froutes%2F%2Bpage.svelte or <script lang="ts">
import * as Drawer from "$lib/components/ui/drawer";
import * as Select from "$lib/components/ui/select";
let fix = false // true to fix
</script>
<Drawer.Root onOutsideClick={(e) => {
if (!fix) return
if (e.target && e.target instanceof HTMLElement && e.target.hasAttribute('data-select-item')) {
e.preventDefault();
}
}}>
<Drawer.Trigger>Open</Drawer.Trigger>
<Drawer.Content class='h-[500px]'>
<Select.Root>
<Select.Trigger class="w-[180px]">
<Select.Value placeholder="Theme" />
</Select.Trigger>
<Select.Content>
<Select.Item value="light">Light</Select.Item>
<Select.Item value="dark">Dark</Select.Item>
<Select.Item value="system">System</Select.Item>
</Select.Content>
</Select.Root>
</Drawer.Content>
</Drawer.Root> |
In my case |
Dialog doesn't work in a controlled way at all. When I close it, the |
@huntabyte how would you suggest handling the case when we have a Drawer which then opens up a Dialog? In this case, I'd want to close them in FIFO order, meaning clicking outside should close the Dialog but not the Drawer, then clicking a second time will close the Drawer. Currently, if I apply |
Describe the bug
If using a store in melt to control open, then clickoutside still works. In Drawer/Dialog it doesn't.
https://shadcdn-drawer.vercel.app/
Reproduction
https://github.com/hartwm/shadcdn-drawer
Logs
No response
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: