Skip to content

feat(theme)!: remove animation.scale and export useReduceMotion - #5235

Open
Doberjohn wants to merge 2 commits into
mainfrom
@Doberjohn/remove-animation-scale
Open

Doberjohn wants to merge 2 commits into
mainfrom
@Doberjohn/remove-animation-scale

Conversation

@Doberjohn

Copy link
Copy Markdown
Collaborator

Motivation

theme.animation.scale reached 16 components, while Checkbox, Switch, FAB and others read only useReduceMotion(), and a component theme prop could undo reduceMotion="on". This removes theme.animation: the 16 read useReduceMotion(), now exported with ReduceMotionPreference. 'auto' starts from the launch-time device setting. The guides are updated.

Related issue

Follow-up to #4924.

Screenshots / Videos

None: nothing changes with default settings.

Test plan

  • yarn typecheck, yarn lint, yarn test.
  • Web: Menu, Dialog, Snackbar, Banner, Chip and ProgressBar keep their durations, and snap with reduceMotion="on".
  • iOS 27.2, Android 13: Dialog and RadioButton work with the device setting off and on; 'auto' reads it on the first render.

The 16 components that multiplied durations by `theme.animation.scale`
now read `useReduceMotion()`, which is exported with the
`ReduceMotionPreference` type. A component's `theme` prop can no longer
turn animations back on under reduce motion, `'auto'` starts from the
device setting at launch, and an OS setting change no longer replays
Banner, CrossFadeIcon or ActivityIndicator animations.

BREAKING CHANGE: `theme.animation.scale` is removed; pass
`reduceMotion="on"` to `PaperProvider` to turn animations off, and read
the preference with `useReduceMotion()`.
@github-actions

Copy link
Copy Markdown

Found potential problems with the pull request:

  • Screenshot or video evidence is missing. Make sure to include one if it affects the UI.

@apex-sentinel-staging

This comment has been minimized.

@apex-sentinel-staging apex-sentinel-staging Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Apex Sentinel: 2 new findings on 38d67ab. The verdict and the full list are in the summary comment.

Comment thread src/core/useResolvedReduceMotion.ts Resolved
Comment thread docs/6.x/docs/guides/theming.mdx Resolved
@apex-sentinel-staging

Copy link
Copy Markdown

Apex Sentinel · ✅ Approve · review of fdabe19

Since the review of 38d67ab: 0 new · 0 still open · 2 no longer raised

No open findings.

Not in the reviewers' prompt (1 file)
  • src/components/__tests__/__snapshots__/ListSection.test.tsx.snap: generated or a lockfile, so its lines were left out

1 finding below minor hidden (user_settings.min_severity).

Reviewed with this repository's own Sentinel configuration (c90b65c6b8bc).

💬 Talking to Sentinel

In a finding's thread, reply with:

Command What it does
@apex-sentinel-staging note <context> Adds context; Sentinel re-checks the cited code
@apex-sentinel-staging pivot <why> Says the finding is wrong; Sentinel re-checks the cited code
@apex-sentinel-staging like Marks the finding as useful
@apex-sentinel-staging dislike <why> Marks it as not useful, so it is not raised again

On this conversation, comment @apex-sentinel-staging review to run a full review once again.

This branch has not been deployed

No deployments
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.

1 participant