Repository navigation
Map: honour prefers-reduced-motion for flyTo and zoom animations - #305
Merged
yakew7 merged 1 commit intoOct 23, 2026
Conversation
Contributor
Author
|
I have read the CLA Document and I hereby sign the CLA |
Contributor
|
@jay23606 is attempting to deploy a commit to the studentsuite Team on Vercel. A member of the Team first needs to authorize it. |
jay23606
deleted the
pr-go/297-map-ignores-prefers-reduced-motion-flyto
branch
October 23, 2026 19:54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Clicking a cluster, locating yourself, selecting a pin or choosing a city all called Leaflet's animated
flyTo/flyToBounds, and the map's zoom, fade and marker-zoom animations were always on. Visitors withprefers-reduced-motion: reducestill got long animated pans and zooms, which can trigger vestibular symptoms. Only the hero particles honoured the setting.Change
map-view.tsx: a smallprefersReducedMotion()helper (guarded for SSR and environments withoutmatchMedia).flyTo/flyToBoundscalls (cluster click, cluster keydown,FlyToUser,FlyToPlace,FlyToBounds) passanimate: !prefersReducedMotion(), read at call time.MapContainergetszoomAnimation,fadeAnimationandmarkerZoomAnimationset from the same check.With the setting off, the options are
animate: true, which is Leaflet's default, so the animations are unchanged.Testing
src/components/map/map-view.test.tsx: it stubsmatchMediato match(prefers-reduced-motion: reduce)and assertsflyToreceivesanimate: false. It fails on the base code withexpected "vi.fn()" to be called with argumentsand passes with the change.npm run test:unitpasses (580 tests).npm run lintandnpx tsc --noEmitpass.npx prettier --check --end-of-line crlf ...).Not verified in a browser with devtools emulation; the unit test covers the call options only.
Refs #297
Regression test: fails on base twice (/to be called with arguments/), passes on fix twice (
npx vitest run src/components/map/map-view.test.tsx -t "prefers-reduced-motion")Fixes #297