From 259f3584d257de7c811dbb4b031fb563f2a7976d Mon Sep 17 00:00:00 2001 From: Segun Adebayo Date: Thu, 9 Nov 2023 14:59:03 +0000 Subject: [PATCH] fix(dialog): remove hidden attr from positioner --- .changeset/thirty-chairs-tickle.md | 8 ++++++++ packages/machines/dialog/src/dialog.connect.ts | 2 -- 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 .changeset/thirty-chairs-tickle.md diff --git a/.changeset/thirty-chairs-tickle.md b/.changeset/thirty-chairs-tickle.md new file mode 100644 index 0000000000..420ab9192f --- /dev/null +++ b/.changeset/thirty-chairs-tickle.md @@ -0,0 +1,8 @@ +--- +"@zag-js/dialog": patch +--- + +Fix issue where dialog positioner applied the `hidden` attribute when closed leading to pre-mature exit of css +animations applied to the dialog content. + +> Only the backdrop and content should use the `hidden` attribute. diff --git a/packages/machines/dialog/src/dialog.connect.ts b/packages/machines/dialog/src/dialog.connect.ts index 6f2a5e303f..9debea931b 100644 --- a/packages/machines/dialog/src/dialog.connect.ts +++ b/packages/machines/dialog/src/dialog.connect.ts @@ -42,9 +42,7 @@ export function connect(state: State, send: Send, normalize positionerProps: normalize.element({ ...parts.positioner.attrs, dir: state.context.dir, - hidden: !isOpen, id: dom.getPositionerId(state.context), - "data-state": isOpen ? "open" : "closed", style: { pointerEvents: isOpen ? undefined : "none", },