vmware-clarity / core

Clarity is a scalable, accessible, customizable, open-source design system built with web components. Works with any JavaScript framework, created for enterprises, and designed to be inclusive.
https://clarity.design
MIT License
161 stars 42 forks source link

Setting `cds-motion="off"` in `CdsSelect` doesn't turn off `cds-button-expand` animation #282

Open squidjam opened 7 months ago

squidjam commented 7 months ago

Describe the bug

Setting cds-motion to off on CdsSelect (react) doesn't turn off the inner cds-button-expand's animation, making it so that visual regression testing doesn't pass.

How to reproduce

Steps to reproduce the behavior:

Expected behavior

If any parent component has a setting to turn off animation, this should be passed along to the child components too. Alternatively, a mechanism should be provided to override this behavior.

Versions

Clarity project:

Clarity version:

Framework:

Framework version: React 18

Device:

Additional notes

squidjam commented 7 months ago

The way I'm starting to look at this gets me to think that perhaps all animations should be disabled (or set at least to --cds-global-animation-duration-instant) when on @media (prefers-reduced-motion).

This would give developers using the design system a chance to have automated visual regression testing never fail due to animations.

As an added bonus, those of us who have the setting up would benefit from this already as an accessibility feature.

squidjam commented 2 months ago

plink