Skip to content

Conversation

@joe-op
Copy link

@joe-op joe-op commented Jul 27, 2024

For users with reduced motion settings enabled, disable the CSS shake animation for invalid input.

Description

For users who prefer reduced motion, disable the shake animation for invalid input.

This setting is typically enabled at the OS level. For example, a user selects "disable animations" or "reduce motion" in their computer's Accessibility or Display settings.

The implementation uses a media query for prefers-reduced-motion to disable the shake animation.

Motivation and Context

Users with reduced motion preference enabled may have difficulty with animations.

Fixes #10041

How Has This Been Tested?

I ran the dev server, selected "Try it out" on an endpoint, and tried to submit letters in an integer field.

I first ran this with "reduce motion" disabled on my Mac, and saw that the shake animation still occurred.

I then enabled "reduce motion" on my Mac, refreshed the page, repeated the test, and saw that the shake animation did not occur.

Screenshots (if appropriate):

Checklist

My PR contains...

  • No code changes (src/ is unmodified: changes to documentation, CI, metadata, etc.)
  • Dependency changes (any modification to dependencies in package.json)
  • Bug fixes (non-breaking change which fixes an issue)
  • Improvements (misc. changes to existing features)
  • [x ] Features (non-breaking change which adds functionality)

My changes...

  • are breaking changes to a public API (config options, System API, major UI change, etc).
  • are breaking changes to a private API (Redux, component props, utility functions, etc.).
  • are breaking changes to a developer API (npm script behavior changes, new dev system dependencies, etc).
  • [ x] are not breaking changes.

Documentation

  • [x ] My changes do not require a change to the project documentation.
  • My changes require a change to the project documentation.
  • If yes to above: I have updated the documentation accordingly.

Automated tests

  • My changes can not or do not need to be tested.
  • My changes can and should be tested by unit and/or integration tests.
  • If yes to above: I have added tests to cover my changes.
  • If yes to above: I have taken care to cover edge cases in my tests.
  • [x ] All new and existing tests passed.

@joe-op joe-op force-pushed the ft/10041-reduced-motion-preference branch from c484948 to 65e09f5 Compare September 6, 2024 13:37
@joe-op joe-op force-pushed the ft/10041-reduced-motion-preference branch from 65e09f5 to 8cba0f2 Compare October 5, 2024 15:45
@joe-op joe-op force-pushed the ft/10041-reduced-motion-preference branch from 8cba0f2 to 0814dc4 Compare October 13, 2024 19:40
@mgifford
Copy link

This is a pretty easy addition:

    @media (prefers-reduced-motion) {
        animation: none;
    }

No piece of software should be happy to know that it can make their users physically ill.

Still, I think we need more than this addition. At least I haven't seen it applied this way.

@joe-op I think this is part of the solution, but not sufficient:

https://www.smashingmagazine.com/2021/10/respecting-users-motion-preferences/

https://css-tricks.com/introduction-reduced-motion-media-query/

@joe-op joe-op force-pushed the ft/10041-reduced-motion-preference branch from 0814dc4 to 0e609d1 Compare December 21, 2024 17:10
@joe-op
Copy link
Author

joe-op commented Dec 21, 2024

Updated to apply the animation inside the media query as in the linked articles.

@joe-op joe-op force-pushed the ft/10041-reduced-motion-preference branch 2 times, most recently from 89928dc to 4818c98 Compare January 27, 2025 04:16
@joe-op joe-op force-pushed the ft/10041-reduced-motion-preference branch from 4818c98 to 34270ca Compare March 6, 2025 12:54
@joe-op joe-op force-pushed the ft/10041-reduced-motion-preference branch from da32b40 to cf44b55 Compare January 31, 2026 15:41
Only enable the CSS error animations for invalid input if the user has
not indicated a preference against animations.
@joe-op joe-op force-pushed the ft/10041-reduced-motion-preference branch from cf44b55 to 50b1e5d Compare January 31, 2026 16:37
@joe-op joe-op changed the title Disable shake for users with reduced motion preference Disable error animations for users with reduced motion preference Jan 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable animations for users with reduced motion preferences

2 participants