Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add respectPrefersReducedMotion map option #12694

Merged
merged 1 commit into from
May 4, 2023

Conversation

stepankuzmin
Copy link
Contributor

Adds respectPrefersReducedMotion map option (true by default). If set to true, the map will respect the user's prefers-reduced-motion browser setting and apply a reduced motion mode, minimizing animations and transitions if it is set to reduce. When set to false, the map will always ignore the prefers-reduced-motion settings, regardless of the user's preference, making all animations essential.

respectPrefersReducedMotion.mov

See also #849, #8883, and #12631

Launch Checklist

  • briefly describe the changes in this PR
  • include before/after visuals or gifs if this PR includes visual changes
  • write tests for all new functionality
  • document any changes to public APIs
  • manually test the debug page
  • tagged @mapbox/gl-native if this PR includes shader changes or needs a native port
  • apply changelog label ('bug', 'feature', 'docs', etc) or use the label 'skip changelog'
  • add an entry inside this element for inclusion in the mapbox-gl-js changelog: <changelog>Add "respectPrefersReducedMotion" map option</changelog>

@stepankuzmin stepankuzmin requested a review from a team as a code owner May 3, 2023 16:41
Copy link
Contributor

@rreusser rreusser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just saw this in passing, and on a subtle note I like the API naming, as opposed to a goofy three-state boolean prefersReducedMotion: true | false | null where null means unspecified and uses the browser setting. Will fall short of "approve" since just a drive-by review, but it does look good to me. 👍

@@ -90,8 +90,7 @@ export type CameraOptions = {
bearing?: number,
pitch?: number,
around?: LngLatLike,
padding?: PaddingOptions,
offset?: PointLike
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this deletion in passing of an unused property?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that was accidentally added in #11524. We don't support offset in CameraOptions, so there is no way to use offset with jumpTo. One related thing I've stumbled on is #7902, but we can address it in a separate PR.

@stepankuzmin stepankuzmin requested a review from mourner May 4, 2023 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants