An open source design system that's fully customizable and agent ready
TypeScript
fix(core): add prefers-reduced-motion to Chat component transitions (#4136)
Cindy Zhang4bbba6534b37
diff --git a/.changeset/chat-motion-safety.md b/.changeset/chat-motion-safety.mdnew file mode 100644index 0000000000..da6949dc72--- /dev/null+++ b/.changeset/chat-motion-safety.md@@ -0,0 +1,7 @@+---+'@astryxdesign/core': patch+---++[fix] Honor `prefers-reduced-motion` in ChatToolCalls (chevron rotation, expand/collapse), ChatLayoutScrollButton (pill show/hide), and ChatDictationButton (equalizer bars).++@cixzhangdiff --git a/packages/core/src/Chat/ChatDictationButton.tsx b/packages/core/src/Chat/ChatDictationButton.tsxindex deaba34156..f8fb838dcc 100644--- a/packages/core/src/Chat/ChatDictationButton.tsx+++ b/packages/core/src/Chat/ChatDictationButton.tsx@@ -66,7 +66,10 @@ const styles = stylex.create({borderRadius: radiusVars['--radius-full'],transformOrigin: 'center',transitionProperty: 'transform, background-color',- transitionDuration: '0.06s',+ transitionDuration: {+ default: '0.06s',+ '@media (prefers-reduced-motion: reduce)': '0s',+ },transitionTimingFunction: 'ease-out',},});diff --git a/packages/core/src/Chat/ChatLayoutScrollButton.tsx b/packages/core/src/Chat/ChatLayoutScrollButton.tsxindex 5a64c56c20..33540cd48d 100644--- a/packages/core/src/Chat/ChatLayoutScrollButton.tsx+++ b/packages/core/src/Chat/ChatLayoutScrollButton.tsx@@ -69,7 +69,10 @@ const styles = stylex.create({height: '32px',transitionProperty: 'opacity, transform, max-width',transitionTimingFunction: easeVars['--ease-standard'],- transitionDuration: durationVars['--duration-fast-max'],+ transitionDuration: {+ default: durationVars['--duration-fast-max'],+ '@media (prefers-reduced-motion: reduce)': '0s',+ },},hidden: {opacity: 0,diff --git a/packages/core/src/Chat/ChatToolCalls.tsx b/packages/core/src/Chat/ChatToolCalls.tsxindex 58337f287a..f764863c66 100644--- a/packages/core/src/Chat/ChatToolCalls.tsx+++ b/packages/core/src/Chat/ChatToolCalls.tsx@@ -133,7 +133,10 @@ const styles = stylex.create({width: '14px',height: '14px',color: colorVars['--color-text-disabled'],- transition: `transform ${durationVars['--duration-fast']} ${easeVars['--ease-standard']}`,+ transition: {+ default: `transform ${durationVars['--duration-fast']} ${easeVars['--ease-standard']}`,+ '@media (prefers-reduced-motion: reduce)': 'none',+ },},chevronExpanded: {transform: 'rotate(180deg)',@@ -141,7 +144,10 @@ const styles = stylex.create({groupContent: {display: 'grid',gridTemplateRows: '0fr',- transition: `grid-template-rows ${durationVars['--duration-medium']} ${easeVars['--ease-standard']}`,+ transition: {+ default: `grid-template-rows ${durationVars['--duration-medium']} ${easeVars['--ease-standard']}`,+ '@media (prefers-reduced-motion: reduce)': 'none',+ },},groupContentExpanded: {gridTemplateRows: '1fr',@@ -266,7 +272,10 @@ const styles = stylex.create({width: '14px',height: '14px',color: colorVars['--color-text-disabled'],- transition: `transform ${durationVars['--duration-fast']} ${easeVars['--ease-standard']}`,+ transition: {+ default: `transform ${durationVars['--duration-fast']} ${easeVars['--ease-standard']}`,+ '@media (prefers-reduced-motion: reduce)': 'none',+ },marginInlineStart: 'auto',},callDetailContent: {