Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

fix(core): guard Dialog entry animation with prefers-reduced-motion (#3984)

Baraa Hamodi6f27a83010e4
diff --git a/.changeset/dialog-reduced-motion.md b/.changeset/dialog-reduced-motion.md
new file mode 100644
index 0000000000..ab93e09d56
--- /dev/null
+++ b/.changeset/dialog-reduced-motion.md
@@ -0,0 +1,6 @@
+---
+'@astryxdesign/core': patch
+---
+
+[fix] Dialog: the entry animation is disabled under prefers-reduced-motion, matching the Layer animation guards.
+@bhamodi
diff --git a/packages/core/src/Dialog/Dialog.tsx b/packages/core/src/Dialog/Dialog.tsx
index 1f27ca2b38..203e6688a9 100644
--- a/packages/core/src/Dialog/Dialog.tsx
+++ b/packages/core/src/Dialog/Dialog.tsx
@@ -152,7 +152,13 @@ const styles = stylex.create({
open: {
display: 'flex',
opacity: 1,
- animationName: enterDirectional,
+ // Disable the entry keyframe animation under
+ // `prefers-reduced-motion: reduce` so the dialog appears instantly
+ // instead of translating/scaling in (same pattern as layerAnimations).
+ animationName: {
+ default: enterDirectional,
+ '@media (prefers-reduced-motion: reduce)': 'none',
+ },
},
// Backdrop using ::backdrop pseudo-element
backdrop: {
@@ -531,7 +537,11 @@ export function Dialog({
),
className,
style,
- )}>
+ )}
+ data-testid={
+ (props as Record<string, unknown>)['data-testid'] as
+ string | undefined
+ }>
{innerContent}
</div>
);