Skip to content

Commit b2aea43

Browse files
authored
fix: controlled animation issues (#49)
* fix: controlled animation issues * add changeset
1 parent 1a95737 commit b2aea43

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

.changeset/gorgeous-news-wait.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"vaul-svelte": patch
3+
---
4+
5+
fix: controlled animation issues

src/lib/vaul/components/root.svelte

+10-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@
2727
export let direction: $$Props["direction"] = "bottom";
2828
2929
const {
30-
states: { keyboardIsOpen, activeSnapPoint: localActiveSnapPoint, drawerId, openDrawerIds },
30+
states: {
31+
keyboardIsOpen,
32+
activeSnapPoint: localActiveSnapPoint,
33+
drawerId,
34+
openDrawerIds,
35+
isOpen,
36+
},
3137
methods: { closeDrawer, openDrawer },
3238
options: { dismissible: localDismissible },
3339
updateOption,
@@ -81,6 +87,9 @@
8187
$: updateOption("backgroundColor", backgroundColor);
8288
$: updateOption("dismissible", dismissible);
8389
$: updateOption("direction", direction);
90+
91+
$: open && !$isOpen && openDrawer();
92+
$: !open && $isOpen && closeDrawer();
8493
</script>
8594

8695
<DialogPrimitive.Root

0 commit comments

Comments
 (0)