A note editor slides a small Saved badge into view after a change. The saved state already has plain text, so the badge can appear immediately for visitors who request reduced motion. Put the override after the animated rule so selectors of equal specificity resolve in the intended order.
.save-notice.is-visible { animation: slide-in 200ms ease-out; }
@media (prefers-reduced-motion: reduce) {
.save-notice.is-visible { animation: none; }
}
Make the visible end state part of the element's normal styles. If the keyframes supply its only visible opacity or final position, removing the animation can leave the notice hidden. The rule above assumes is-visible makes the badge visible independently.
Test with the operating system's reduced-motion setting or the browser's media emulation. Save one change in each mode. Confirm that both show the same message and that the reduced-motion version appears without sliding. If your application removes the badge in an animationend listener, test that removal too. Drive the life cycle from the save state or its own expiry rule so the reduced-motion path can finish even when no animation runs.
Test two saves and one failed request
With reduced motion enabled, save once successfully. Verify that the status becomes visible while the save is current. Save again before the first message would ordinarily clear and check that the new notice remains readable. If the old expiry hides it early, restart the expiry when a new success arrives. Simulate a failed save as well and confirm that it shows your application’s error state without briefly reporting “Saved.” Repeat the same actions with motion enabled to make sure both modes display feedback from the same save state.
