Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/core/tokens/shared_tokens.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
/*
Expand Down
2 changes: 2 additions & 0 deletions src/stories/Components/Alert/Alert.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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.

<img src={imageFile} alt="Flash" />

## Alert Structure
Expand Down
Loading