Respect reduced motion preference for Lottie animations#83522
Respect reduced motion preference for Lottie animations#83522chuckdries merged 1 commit intomainfrom
Conversation
When the OS-level reduced motion accessibility setting is enabled, Lottie animations now stop playing. This is done by overriding autoPlay and loop to false in the shared Lottie component, and skipping the play() call on navigation focus. Co-authored-by: Rushat Gabhane <rushatgabhane@users.noreply.github.com>
|
@aimane-chnaif all yours! |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@MelvinBot mark this as ready for review |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb Safari |
|
@codex review |
|
@dubielzyk-expensify @aimane-chnaif One of you needs to copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
Done! PR has been marked as ready for review. 🤖 |
|
We did not find an internal engineer to review this PR, trying to assign a random engineer to #76915 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
|
Lovely. I think there's an argument to be made that we should swap out the illustration for an image here. Is it possible to decide where to pause the animation? |
|
yes we can pause the animation at some point but there's no direct prop like "duration" to pause/stop animation. We will need to add setTimeout. |
|
That's fine then. Let's get this out into the product and leave it as is. It's mostly a key thing to turn off the animation and respect a11y system settings |
JmillsExpensify
left a comment
There was a problem hiding this comment.
No product review required on this one.
|
thanks for the review @aimane-chnaif |
chuckdries
left a comment
There was a problem hiding this comment.
I think long term it's not a bad idea to define a fallback image (or maybe just a timestamp?) on a per-animation bases, but yeah big agree let's merge this ASAP!
|
🚧 @chuckdries has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚀 Deployed to staging by https://github.com/chuckdries in version: 9.3.28-0 🚀
|
|
🚀 Deployed to staging by https://github.com/chuckdries in version: 9.3.30-0 🚀
|
|
🚀 Deployed to production by https://github.com/blimpich in version: 9.3.30-3 🚀
|

Explanation of Change
When the OS-level reduced motion accessibility setting is enabled (e.g.,
prefers-reduced-motionon web, or the native Reduce Motion setting on iOS/Android), Lottie animations throughout the app now stop playing. This addresses WCAG 2.2.2 (Pause, Stop, Hide) by respecting the system preference.The fix is entirely in the shared
Lottiecomponent:useReducedMotion()fromreact-native-reanimated(already a dependency, already used inAnimatedEmptyStateBackground.tsx)autoPlaytofalseandlooptofalseThis single change automatically applies to all 12+ call sites (SignInHeroImage, Section, EmptyStateComponent, IllustratedHeaderPageLayout, BlockingView, ConfirmationPage, FeatureTrainingModal, etc.) without modifying any of them.
Fixed Issues
$ #76915
PROPOSAL: #76915 (comment)
Tests
Offline tests
No offline-specific behavior changes. The reduced motion detection is a client-side OS setting, unrelated to network state.
QA Steps
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari