Skip to content

feat: add accessibility adaptation layer#4924

Open
adrcotfas wants to merge 1 commit into@adrcotfas/refactor/tokens_elevationfrom
@adrcotfas/refactor/accesibility
Open

feat: add accessibility adaptation layer#4924
adrcotfas wants to merge 1 commit into@adrcotfas/refactor/tokens_elevationfrom
@adrcotfas/refactor/accesibility

Conversation

@adrcotfas
Copy link
Copy Markdown
Collaborator

@adrcotfas adrcotfas commented May 6, 2026

Motivation

The library's existing reduce-motion support set animation.scale = 0 -- a v2-era flag that components had to explicitly check, with no connection to the MD3 theme.motion spring and duration tokens.

This PR wires OS accessibility into the theme properly. useAccessibleTheme replaces the inline PaperProvider logic, subscribes to reduceMotionChanged, and when active collapses theme.motion to instant springs and zero durations via the new reducedMotion preset. A clean theme.motion.prefersReducedMotion: boolean flag gives components a single readable signal instead of the magic scale === 0 check.

animation.scale is kept and still set to 0 for backward compatibility with components that haven't migrated yet. It is now formally deprecated in favour of theme.motion.prefersReducedMotion.

Two further deprecations are added while here: theme.mode ('adaptive' | 'exact'), which is an MD2 elevation-overlay concept superseded by tonal surface colors in theme.colors.elevation.*; and animation.defaultAnimationDuration, which was never read at runtime.
No component behavior changes. The reduce-motion path is functionally equivalent to before for all existing components. theme.motion.prefersReducedMotion and the reducedMotion preset are foundation plumbing -- they will be consumed when components migrate to theme.motion tokens in the per-component PRs that follow.

Related issue

Related issue
See https://www.notion.so/callstack/React-Native-Paper-Foundation-for-MD3-Expressive-34c5d027c0f880edba3df107cd35946f?source=copy_link

Merge order:

Test plan

  • yarn typescript -- no new type errors
  • yarn test -- all tests pass

@callstack-bot
Copy link
Copy Markdown

Hey @adrcotfas, thank you for your pull request 🤗. The documentation from this branch can be viewed here.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

The mobile version of example app from this branch is ready! You can see it here.

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.

2 participants