diff --git a/src/core/tokens/shared_tokens.css b/src/core/tokens/shared_tokens.css index 4138c452..435ebba4 100644 --- a/src/core/tokens/shared_tokens.css +++ b/src/core/tokens/shared_tokens.css @@ -245,6 +245,15 @@ var(--op-input-outer-focus) var(--op-color-alerts-notice-plus-five); } +/* @tokens-end keeps the reduced-motion override below out of the Input Focus token docs */ + +@media (prefers-reduced-motion: reduce) { + :root { + /* modern-css-reset forces animation-duration to 0.01ms, so the 5s goes in the delay */ + --op-animation-flash: rm-slide-in-out-flash 0.01ms 5s forwards; + } +} + /* Animations */ @keyframes rm-slide-in-out-flash { /* diff --git a/src/stories/Components/Alert/Alert.mdx b/src/stories/Components/Alert/Alert.mdx index 1a797a8b..49989b92 100644 --- a/src/stories/Components/Alert/Alert.mdx +++ b/src/stories/Components/Alert/Alert.mdx @@ -100,6 +100,8 @@ If your application needs to allow dismissing these alerts, you can add a second The alert component can also be used as an animated notification message by adding `.alert--flash` to the top level. This supports all the alert variations and styles. +For users who prefer reduced motion, the flash appears in place without sliding and hides after 5 seconds. If you override `--op-animation-flash`, also override it inside `@media (prefers-reduced-motion: reduce)`. Put the time in the delay, not the duration, because the reset shortens every animation duration to 0.01ms. + Flash ## Alert Structure