Skip to content

Commit 6091040

Browse files
committed
fix(drawer): prevent backdrop flicker on controlled async close
Keep swipe animation overrides until the drawer enters closing, so a controlled close driven by an async open setter no longer replays the enter animation while still open.
1 parent 9afd82e commit 6091040

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@zag-js/drawer": patch
3+
---
4+
5+
Fix backdrop flicker on controlled close with an async `open` setter by clearing swipe animation overrides only when entering `closing`

packages/machines/drawer/src/drawer.machine.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,6 @@ export const machine = createMachine<DrawerSchema>({
254254
{
255255
guard: and("shouldCloseOnSwipe", "isOpenControlled"),
256256
actions: [
257-
"clearSwipeOpenAnimation",
258257
"clearRegistrySwiping",
259258
"clearPointerStart",
260259
"setDismissSwipeStrength",
@@ -295,7 +294,7 @@ export const machine = createMachine<DrawerSchema>({
295294
CLOSE: [
296295
{
297296
guard: "isOpenControlled",
298-
actions: ["clearSwipeOpenAnimation", "invokeOnClose"],
297+
actions: ["invokeOnClose"],
299298
},
300299
{
301300
target: "closing",

0 commit comments

Comments
 (0)