Skip to content

refactor(core): a theme's reducedMotion 'always' reaches the hooks that hold no element; the chat scroll and streaming text read it - #9763

Merged
cixzhang merged 14 commits into
mainfrom
lane4/r8895-mark
Nov 22, 2026
Merged

cixzhang merged 14 commits into
mainfrom
lane4/r8895-mark

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Supersedes #8895, re-ported onto current main, which now carries #9761 (the reduced-motion mark's private-attribute module, the root and wrapper marks, and the animator's read of them). Part of #8677's split. This is internal: no theme can set reducedMotion: 'always' yet, so there is no behavior change.

This is the first of two stacked pull requests for spec:AST-108 FR6 (every script reader honours a theme's 'always'). This one gives hooks that hold no element a way to read 'always', and moves the chat scroll and streaming text onto it. The follow-up, stacked on this one, moves the other script readers: Carousel, BottomSheet (panel and gestures), MobileNav, AppShell, the mobile keyboard's scroll and press feedback.

Stack order: this pull request, then the follow-up. The follow-up must merge before any change that lets a theme set reducedMotion: 'always', so no theme can reach the state where only some readers honour it.

User impact

  • People using apps: none today. When 'always' ships, streaming text and the chat scroll's follow reduce their motion for everyone under that theme, as they already do for a person whose Reduce Motion setting is on. A swipe row's settle, the animator and the layout glide already read the mark on main.
  • App builders: no API change.
  • Maintainers: one rule for whether motion is reduced: reducesMotion(element) for code that holds an element, and useReducesMotion() for a hook that holds none, both in the reduced-motion mark's owner module, which loads no animator, theme or StyleX module.

What changes

  • privateAttributes/reducedMotion.stylex.ts (the mark's owner module; it calls no StyleX and now starts with 'use client'): beside the DOM mark, ThemeReducesMotionContext (createSharedContext), reducesMotion(element) (the setting, or the mark on the element, an ancestor or <html>) and its hook form useReducesMotion() (the setting, followed live, or the context). The context is true under a theme with 'always' and under every theme nested in one: the mark only adds. This module loads no animator, theme or StyleX module, so a reader on every page adds almost nothing at first load, and the motion foundation still loads in plain Node.
  • theme/Theme.tsx: provides the context, from its own 'always' or an ancestor's.
  • motion/reducedMotion.ts: reducedMotionFade calls the same reducesMotion.
  • motion/animator.ts: decides Reduce Motion with reducesMotion(target), and defaultPrefersReducedMotion delegates to reducesMotion(), so one copy of the rule remains.
  • Chat/useChatStreamScroll.ts, hooks/useStreamingText.ts: read useReducesMotion() in place of the media query alone.
  • spec:AST-108 FR6 gains one sentence: a script reader decides Reduce Motion through the reduced-motion mark's owner module, which counts the person's setting and a theme's 'always' and loads no animator, theme or StyleX module.
  • No new module, and no marker class: component Reduce Motion styles are outside this pull request.

Earlier review findings

  • New internal modules (hooks/useReducesMotion.ts, theme/reducedMotionContext.ts): gone. The readers and the context live beside the mark in privateAttributes/reducedMotion.stylex.ts, an existing module.
  • First-load size: an earlier revision put the hook in motion/reducedMotion.ts, which imports the animator, and so added about 14 KB gzip to a Markdown page; the owner module loads none of it (figures below).
  • A record for the rule: spec:AST-108 FR6 now names where script readers decide Reduce Motion.
  • createContext: the context is created with createSharedContext.
  • The twin and guard changes, and the stale pending entry: gone with the marker; this pull request touches no Reduce Motion style.
  • The deleted ItemSwipeLayer.tsx: the swipe release on main already reads the mark through reducedMotionFade(rootRef.current) in Swipe/useSwipeAction.ts, so no swipe change is needed.

Evidence

  • theme/themeReducedMotionReaders.test.tsx (new), with the person's setting off:
    • useReducesMotion is true under an 'always' theme and under a theme nested in one, and false under a theme that leaves motion to the setting;
    • streaming text shows the full text under 'always' and reveals it progressively otherwise;
    • a server render under 'always' carries the mark and the full streaming text.
  • Chat/useChatStreamScroll.test.tsx: under an 'always' theme, streaming growth jumps in one step with no animation frame.
  • Red first: with this pull request's source reverted to main, 5 of these cases fail.
  • First-load size (architecture:component-import-boundaries), node scripts/measure-reference-pages.mjs against main 3786705, gzip: docs +72 B, form +56 B, menu −42 B, table +11 B; a Markdown page +122 B.
  • Other checks: the theme, motion, private-attribute, Chat, streaming-text, shared-context, Resizable, Swipe, gestures, animator and drag-to-snap suites pass (151 files, 4,479 tests), including the server tests that require no DOM work at import. scripts/motion-node-load.test.mjs passes. tsc, the 'use client' check, check:knowledge and prettier pass.
  • Preflight (Linux build machine, at 24e19ec): build, typecheck, vitest ui, knowledge and changesets passed; lint ('use client') and scripts/motion-node-load.test.mjs failed there, which this head fixes. The scoped browser specs LayerReducedMotion, SelectorReducedMotion and ReducedMotionPress pass (16).

Credit

@vjeux's design and code from #8895, re-ported onto current main and #9761. Co-authored-by trailer on the commit.

Owner: fix-loop lane 0. Land path: Specs stamp, CodeBunny, preflight, then the drain merges after the normal gates.

Review notes at b312f7b

CodeBunny's notes at this head are folded into the next pull request in this stack, #13138 (head fb77978): reducesMotion reads the element's own window, so the layout glide calls it and keeps no copy of the rule, and the defaultPrefersReducedMotion comment now says it is the setting alone. The note about a record line for useReducesMotion has no record to change: none defines it. This pull request merges first; #13138 and #13512 follow on the same main.

cixzhang and others added 4 commits November 3, 2026 07:23
…' ships

Plumbing for spec:AST-108 FR6, with no change for anyone today: no public
theme can set reducedMotion, and resolveKnobs still resolves every theme to
'system', so no theme marks its root.

- privateAttributes/reducedMotion.stylex.ts owns data-astryx-reduced-motion:
  reducedMotionMarkProps and setRootReducedMotionMark write it, and
  themeReducesMotion reads it on an element, an ancestor, or <html>.
- Theme marks its wrapper, and the root theme marks <html>, with the
  attribute and the --_astryx-reduced-motion custom property when the
  theme's motion resolves reducedMotion to 'always'. The server renders the
  mark.
- The animator, reducedMotionFade and the layout glide count the mark as the
  person's Reduce Motion setting.
- ThemeReducedMotion (internal) widens to 'system' | 'always'.

Tests cover the reader, the three readers' use of it, and the Theme mark
through a mocked resolveMotionKnobs.

Co-authored-by: Christopher Chedeau <[email protected]>
…and the chat scroll, streaming text and swipe settle read it

Internal, like the mark it builds on: no theme can set reducedMotion
'always' yet, so nothing changes for anyone.

- theme/reducedMotion.markers.stylex.ts defines reducedMotionScope. Theme
  puts it on the marked wrapper, and the root theme writes its class on
  <html> beside the mark, so a Reduce Motion style keyed on
  stylex.when.ancestor('[data-astryx-reduced-motion]', reducedMotionScope)
  reaches portaled layers.
- motion/reducedMotion.ts adds reducesMotion(element): the person's setting
  or the mark. hooks/useReducesMotion.ts is its hook form, for a hook that
  holds no element: the setting, followed live, or the theme tree through
  ThemeReducesMotionContext, where a nested theme never removes an
  ancestor's 'always'.
- useChatStreamScroll, useStreamingText and ItemSwipeLayer read them.
- motion/reducedMotion.test.ts guards the rest with lists that only shrink:
  every Reduce Motion arm needs its twin on the mark, and every script read
  of the setting needs the mark. A read through a constant that holds the
  query counts.
- Tests reach 'always' through a themeMotion mock
  (theme/reducedMotionAlways.testing.ts).

Co-authored-by: Christopher Chedeau <[email protected]>
@vercel

vercel Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Nov 22, 2026 5:10am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 3, 2026
@astracat-bot

astracat-bot Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Nov 22, 2026, 5:41 AM UTC

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested. The refactor changes no behavior today and fits the theme-motion spec, but the twin contract it introduces conflicts with the private-attribute rule.

  • The reduced-motion guard (packages/core/src/motion/reducedMotion.test.ts:50-51) and the examples in theme/reducedMotion.markers.stylex.ts and motion/reducedMotion.ts require each component to write stylex.when.ancestor('[data-astryx-reduced-motion]', reducedMotionScope) itself, which architecture:public-component-api INV23 forbids and @astryx/no-raw-private-attribute rejects in CI; move the twin selector into privateAttributes/reducedMotion.stylex.ts as ready-made styles and have the guard accept a spread of them.

Non-blocking: useReducesMotion reads only the theme context, so it misses a root 'always' inside useToast's detached fallback root, and a few new comments restate the hook (see the inline notes).

[Automated review]

Comment thread packages/core/src/theme/Theme.tsx Resolved
…le that calls no StyleX

The animator reads the reduced-motion mark through its owner module, which
the private-attribute rule names .stylex.ts. The module imports nothing, and
the check that the graph reaches no @stylexjs import still holds it to that.

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested. The refactor changes no behavior today and fits the theme-motion spec, but the twin contract it sets up conflicts with the private-attribute rule.

  • The reduced-motion guard (packages/core/src/motion/reducedMotion.test.ts:50-51) and the examples in theme/reducedMotion.markers.stylex.ts and motion/reducedMotion.ts have each component write stylex.when.ancestor('[data-astryx-reduced-motion]', reducedMotionScope) itself, which architecture:public-component-api INV23 forbids and @astryx/no-raw-private-attribute rejects in CI; move the twin selector into privateAttributes/reducedMotion.stylex.ts as ready-made styles and have the guard accept a spread of them.

Non-blocking: useReducesMotion reads only the theme context, so it misses a root 'always' in a separate React root such as useToast's fallback viewport, which matters once 'always' ships. A few new comments restate the hook or narrate the code (Item/ItemSwipeLayer.tsx:208, Chat/useChatStreamScroll.ts:260, hooks/useStreamingText.ts:175-177, theme/Theme.tsx:301-306).

[Automated review]

The old base (#9761) landed squashed, so this resolves as main plus this
branch's own changes. main's later Reduce Motion work updates the
pending lists: ClickableCard, SelectableCard, Spinner's rotor, Thumbnail,
the press module and useMobileKeyboard are listed; Lightbox, Spinner,
AppShell and MobileNav come off (main removed their arms or reads).
@cixzhang
cixzhang changed the base branch from lane4/theme-always-mark to main November 12, 2026 01:28
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Nov 12, 2026
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · b312f7b

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
ChatComposer 90.8 kB (0) · 13.5 kB CSS (0) — — · ✗ · —
ChatComposerInput 88.0 kB (0) · 12.5 kB CSS (0) — — · ✗ · —
lab/AudioPlayer 234.8 kB (+181 B) · 1.8 kB CSS (0) — — · — · —
80 more components
Component Size LoC Visual · A11y · RTL
Markdown 210.3 kB (+169 B) · 23.5 kB CSS (0) — — · — · —
lab/MediaPlaybackRate 224.8 kB (+150 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaFullscreenButton 224.8 kB (+149 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaCaptionsButton 224.8 kB (+148 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaTime 224.8 kB (+148 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaTimeSlider 224.8 kB (+147 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaVolume 224.8 kB (+146 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaPlayButton 224.8 kB (+145 B) · 1.5 kB CSS (0) — — · — · —
lab/MediaSeekButton 224.8 kB (+145 B) · 1.5 kB CSS (0) — — · — · —
lab/VideoPlayer 232.4 kB (+124 B) · 2.1 kB CSS (0) — — · — · —
richtext/RichTextEditorToolbar 316.4 kB (+116 B) · 454 B CSS (0) — — · — · —
lab/CommentThread 382.9 kB (+101 B) · 2.4 kB CSS (0) — — · — · —
PowerSearch 319.5 kB (+100 B) · 27.3 kB CSS (0) — — · — · —
lab/NavigationScreen 86.6 kB (+94 B) · 1.5 kB CSS (0) — — · — · —
lab/NavigationStack 86.6 kB (+94 B) · 1.5 kB CSS (0) — — · — · —
lab/TabBarMoreList 105.1 kB (+94 B) · 1.8 kB CSS (0) — — · — · —
lab/TransferList 139.9 kB (+86 B) · 1.2 kB CSS (0) — — · — · —
Switch 111.8 kB (+85 B) · 10.5 kB CSS (0) — — · — · —
lab/TransferListSelector 151.8 kB (+85 B) · 1.4 kB CSS (0) — — · — · —
Pagination 154.3 kB (+82 B) · 20.1 kB CSS (0) — — · — · —
lab/Comments 389.8 kB (+82 B) · 2.5 kB CSS (0) — — · — · —
AlertDialog 134.0 kB (+75 B) · 16.2 kB CSS (0) — — · — · —
Slider 117.2 kB (+68 B) · 9.3 kB CSS (0) — — · — · —
Lightbox 151.3 kB (+65 B) · 12.3 kB CSS (0) — — · — · —
lab/PageControl 79.1 kB (+59 B) · 709 B CSS (0) — — · — · —
SegmentedControl 103.7 kB (+58 B) · 7.2 kB CSS (0) — — · — · —
lab/CommentComposer 186.5 kB (+58 B) · 1.9 kB CSS (0) — — · — · —
TextArea 95.3 kB (+57 B) · 10.0 kB CSS (0) — — · — · —
lab/EmojiPicker 121.3 kB (+57 B) · 751 B CSS (0) — — · — · —
Outline 26.9 kB (+55 B) · 4.2 kB CSS (0) — — · — · —
ChatLayout 91.3 kB (+53 B) · 11.7 kB CSS (0) — — · ✓ · —
TimeInput 181.4 kB (+51 B) · 17.9 kB CSS (0) — — · — · —
DateInput 209.3 kB (+46 B) · 19.0 kB CSS (0) — — · — · —
lab/TabBar 84.7 kB (+45 B) · 1.8 kB CSS (0) — — · — · —
DateTimeInput 233.1 kB (+44 B) · 20.7 kB CSS (0) — — · — · —
SideNav 125.3 kB (+44 B) · 12.5 kB CSS (0) — — · — · —
BottomSheet 76.5 kB (+43 B) · 7.8 kB CSS (0) — — · — · —
CheckboxList 75.8 kB (+43 B) · 8.2 kB CSS (0) — — · — · —
TreeList 47.5 kB (+42 B) · 6.0 kB CSS (0) — — · — · —
DropdownMenuCheckboxItem 29.5 kB (+39 B) · 7.6 kB CSS (0) — — · — · —
DropdownMenuRadioItem 29.6 kB (+38 B) · 7.6 kB CSS (0) — — · — · —
ContextMenuItem 39.1 kB (+36 B) · 7.3 kB CSS (0) — — · — · —
TextInput 101.6 kB (+35 B) · 12.9 kB CSS (0) — — · — · —
MoreMenu 114.4 kB (+32 B) · 19.8 kB CSS (0) — — · — · —
NumberInput 106.6 kB (+32 B) · 13.1 kB CSS (0) — — · — · —
Popover 105.0 kB (+31 B) · 15.5 kB CSS (0) — — · — · —
ContextMenu 106.0 kB (+29 B) · 19.6 kB CSS (0) — — · — · —
SelectorOption 24.8 kB (+28 B) · 6.8 kB CSS (0) — — · — · —
DropdownMenuItem 28.7 kB (+27 B) · 7.1 kB CSS (0) — — · — · —
List 19.6 kB (+26 B) · 810 B CSS (0) — — · — · —
AppShell 102.1 kB (+25 B) · 14.9 kB CSS (0) — — · — · —
DropdownMenu 114.1 kB (+25 B) · 19.8 kB CSS (0) — — · — · —
lab/ChatReactionBar 129.9 kB (+23 B) · 1.1 kB CSS (0) — — · — · —
Table 125.4 kB (+17 B) · 21.2 kB CSS (0) — — · — · —
Selector 121.1 kB (+15 B) · 19.7 kB CSS (0) — — · — · —
Collapsible 30.1 kB (+14 B) · 4.5 kB CSS (0) — — · — · —
TableCell 107.3 kB (+12 B) · 20.2 kB CSS (0) — — · — · —
TableHeaderCell 107.1 kB (+12 B) · 20.0 kB CSS (0) — — · — · —
lab/ChatEmojiPicker 128.7 kB (+11 B) · 773 B CSS (0) — — · — · —
RadioListItem 78.7 kB (+10 B) · 11.2 kB CSS (0) — — · — · —
ListItem 81.8 kB (+4 B) · 12.6 kB CSS (0) — — · — · —
MultiSelector 109.6 kB (+1 B) · 18.9 kB CSS (0) — — · — · —
Tokenizer 113.0 kB (+1 B) · 21.9 kB CSS (0) — — · — · —
ChatComposerDrawer 18.5 kB (0) · 4.8 kB CSS (0) — — · ✓ · —
ChatComposerTokenElement 88.0 kB (0) · 12.5 kB CSS (0) — — · ✓ · —
ChatDictationButton 68.2 kB (0) · 11.2 kB CSS (0) — — · ✓ · —
ChatLayoutScrollButton 68.2 kB (0) · 11.3 kB CSS (0) — — · — · —
ChatMessage 17.4 kB (0) · 3.7 kB CSS (0) — — · ✓ · —
ChatMessageBubble 7.7 kB (0) · 3.8 kB CSS (0) — — · ✓ · —
ChatMessageList 28.7 kB (0) · 7.4 kB CSS (0) — — · ✓ · —
ChatMessageMetadata 21.0 kB (0) · 4.2 kB CSS (0) — — · ✓ · —
ChatSendButton 68.0 kB (0) · 11.1 kB CSS (0) — — · — · —
ChatSystemMessage 7.2 kB (0) · 3.8 kB CSS (0) — — · ✓ · —
ChatTokenizedText 7.7 kB (0) · 4.1 kB CSS (0) — — · ✓ · —
ChatToolCalls 33.1 kB (0) · 8.8 kB CSS (0) — — · ✓ · —
lab/TabBarItem 3.9 kB (0) · 1.8 kB CSS (0) — — · — · —
BreadcrumbItem 102.6 kB (−3 B) · 14.0 kB CSS (0) — — · — · —
DropdownMenuSubMenu 80.7 kB (−3 B) · 11.0 kB CSS (0) — — · — · —
CheckboxListItem 82.7 kB (−6 B) · 12.6 kB CSS (0) — — · — · —
Item 20.9 kB (−29 B) · 6.2 kB CSS (0) — — · — · —

Package size: @astryxdesign/core 7.98 MB packed (+1.2 kB); no new dependencies.

Wide change (shared styles: packages/core/src/theme/Theme.tsx): add ci:run-visual for Visual, ci:run-rtl for RTL.

Accessibility: 2 violation(s)

Accessibility Audit

Status: 2 accessibility violation(s) found — 2 serious.

ChatComposer - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/21 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ChatComposerInput - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/18 stories · Learn more
    • WCAG: 1.4.3 (Level AA)

Generated by PR Enrichment workflow | View full report

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Changes requested. The refactor changes no behavior today and fits the theme-motion spec, but it needs these fixes before it can land:

  • Newly live check: theme/reducedMotionContext.ts creates ThemeReducesMotionContext with a plain createContext, which fails Layer/sharedContexts.test.tsx ("no module creates a context of its own") on this head and would hide 'always' from swizzled copies, so create it with createSharedContext('ThemeReducesMotionContext', 1, false).
  • The reduced-motion guard (packages/core/src/motion/reducedMotion.test.ts:50-51) and the examples in theme/reducedMotion.markers.stylex.ts and motion/reducedMotion.ts have each component write stylex.when.ancestor('[data-astryx-reduced-motion]', reducedMotionScope) itself, which architecture:public-component-api INV23 forbids and @astryx/no-raw-private-attribute rejects in CI, so let privateAttributes/reducedMotion.stylex.ts own the twin and have the guard accept that form.
  • Newly live check: hooks/useReducesMotion.ts is a new internal shared module (imported by Chat/useChatStreamScroll.ts, Item/ItemSwipeLayer.tsx and hooks/useStreamingText.ts) that no current record names: it needs an owner API decision that says why existing modules are not enough.
  • Newly live check: theme/reducedMotionContext.ts is a new internal shared module (imported by theme/Theme.tsx and hooks/useReducesMotion.ts) that no current record names: it needs an owner API decision that says why existing modules are not enough.
  • Regression: motion/reducedMotion.test.ts:143 keeps BottomSheet/useMobileKeyboard.ts on the pending list although that file moved to keyboard/useMobileKeyboard.ts on main, so the entry can never come off; delete it and have the guards fail on a listed path that does not exist.

The earlier non-blocking notes still apply: useReducesMotion misses a root 'always' in a separate React root such as useToast's fallback viewport, and a few new comments restate the hook or narrate the code.

Claims and files checked
  • Changeset: the mark gets its own marker class on the theme's root and on <html> for the root theme: verified (theme/Theme.tsx).
  • Changeset: the chat scroll, streaming text and swipe settle read the mark: verified, through the new theme context.
  • Changeset and description: no theme can set 'always' yet, so nothing changes: verified (theme/motionKnobs.ts always resolves 'system').
  • The marker lives in its own StyleX module and has its own class to avoid matching default-marker hover rules: verified as written.
  • reducesMotion(element) reads the setting or the mark on the element, an ancestor or <html>: verified.
  • useReducesMotion reads the setting live or the theme tree, never loses an ancestor's 'always', and adds no Effect: verified.
  • The three readers switch from the media query to the new hook: verified.
  • The twin guard and the setting-read guard (constant-held queries included) match the head: verified, except one stale entry.
  • The pending lists only shrink and match current main: false for BottomSheet/useMobileKeyboard.ts, which no longer exists.
  • ComplexSelector and Selector join the twin list; the press release stays pending: verified.
  • Tests reach 'always' through a mock of the theme motion module; the changeset is internal and no longer mentions Markdown: verified.
  • Evidence: the marker, portal, reader and nested-theme tests cover what the description says: verified as written; the swipe test proves the flag, and the settle already drops to 0 ms under it.
  • Evidence: under a 'system' theme all three readers keep their motion: true by code; the chat scroll has no 'system'-theme test.
  • Evidence: the listed suites pass: the context guard in Layer/sharedContexts.test.tsx fails on this head.
  • Files: all 15 visited. Blocking findings in theme/reducedMotionContext.ts, hooks/useReducesMotion.ts, motion/reducedMotion.test.ts, motion/reducedMotion.ts and theme/reducedMotion.markers.stylex.ts; non-blocking comment notes in Chat/useChatStreamScroll.ts, Item/ItemSwipeLayer.tsx, hooks/useStreamingText.ts and theme/Theme.tsx; the changeset, the test helper and the five test files are clear.

Automated review (maintainer link)

…eaches the hooks that hold no element

Main now carries the mark's private-attribute module, the root and wrapper
marks, and the animator's read of them (#9761), so this re-port keeps only
what main lacks: Theme passes 'always' down through ThemeReducesMotionContext
(beside Theme's other contexts in useTheme.ts; a nested theme keeps an
ancestor's), and motion/reducedMotion.ts gains reducesMotion(element) and its
hook form useReducesMotion, which the chat scroll and streaming text now
read. The swipe release already reads the mark through reducedMotionFade.
The other script readers follow in a stacked change.

Co-authored-by: Christopher Chedeau <[email protected]>
@cixzhang cixzhang added the lane:0 Astryx fix-loop lane 0 owns this label Nov 21, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec 3bf0014

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved. The theme context and the two hook readers fit the theme-motion spec and change nothing for anyone today, and the new spec sentence has an engineering owner's approval at this head. The required CI gate is red only because one Chromium interaction proof, the BottomSheet drag-restyle count, failed; it runs no code this change touches and passes on the same build outside CI, so a rerun of that shard has to pass before this merges.

Non-blocking notes:

  • Miss: the layout glide still decides Reduce Motion with its own copy of the rule (motion/animatedLayout.ts:227-229), reading the element's own window, while reducesMotion reads the top window; having reducesMotion read the element's ownerDocument.defaultView would let the glide call it, here or in the follow-up.
  • defaultPrefersReducedMotion's doc comment (motion/animator.ts:1213-1221) still says the animator uses it by default, which is no longer true.

The smaller notes: the owner module's new context is not on the public-component-api record's list of owner exports, scripts/motion-node-load.test.mjs still says the foundation loads without React, and the description has no writing-rubric results for the record edit.

Claims and files checked

Review mode: same-head; reason: none

Claims:

  • Changeset: a theme's 'always' reaches hooks that hold no element through a Theme context, and a nested theme keeps an ancestor's: verified (theme/Theme.tsx:432, :521-524; reader tests).
  • Changeset: the new hook reads that context beside the person's setting: verified (privateAttributes/reducedMotion.stylex.ts:92-95).
  • Changeset: the chat scroll and streaming text read it: verified (Chat/useChatStreamScroll.ts:273, hooks/useStreamingText.ts:180).
  • Changeset: the swipe settle and the animator already read the mark: verified (Swipe/useSwipeAction.ts:1090; motion/animator.ts:1364).
  • Changeset: Carousel, BottomSheet, MobileNav, AppShell, the keyboard scroll, press feedback and Resizable follow in a separate change: verified, each still reads the setting alone.
  • Changeset and description: no theme can set 'always' yet, so nothing changes for anyone: verified (theme/motionKnobs.ts:82).
  • Description: re-ported onto current main, which already carries the mark's module, the root and wrapper marks and the animator's read: verified on the base.
  • Description: the stacked follow-up moves the other script readers: another pull request, not checked; its list leaves out Resizable, which the changeset names.
  • Description: a swipe row's settle, the animator and the layout glide already read the mark on main: verified on the base (Swipe/useSwipeAction.ts:1090, motion/animatedLayout.ts:229).
  • Description: no API change for app builders: verified (no added, changed or removed public rows in any published package).
  • Description: maintainers get one rule, reducesMotion(element) and useReducesMotion() in the owner module: verified for every file this change touches; the layout glide keeps its own copy (non-blocking note above).
  • Description: the owner module starts with 'use client', holds the shared context and both readers, and loads no animator, theme or StyleX module: verified (:3, :66-95; its imports).
  • Description: the motion foundation still loads in plain Node: verified (the load test passes).
  • Description: Theme provides the context from its own or an ancestor's 'always', and reducedMotionFade calls the same reducesMotion: verified (theme/Theme.tsx:521-524, motion/reducedMotion.ts:88).
  • Description: the animator decides with reducesMotion(target) and defaultPrefersReducedMotion delegates to it, so one copy remains: verified for the animator (motion/animator.ts:1222-1224, :1364).
  • Description: the two hooks read useReducesMotion() in place of the media query alone: verified.
  • Description: the theme-motion spec's FR6 gains one sentence naming where script readers decide: verified, with an engineering owner's approval at this head.
  • Description: no new module and no marker class: verified (no new source file).
  • Description: the earlier findings are addressed (new modules gone, first-load size, a record for the rule, a shared context, twin and guard changes gone, no swipe change needed): verified.
  • Description evidence: the reader and chat tests cover the hook, nesting, streaming text, a server render and the chat jump with the setting off: verified (they pass on this head; at least five fail on the base).
  • Description evidence: first-load gzip docs +72 B, form +56 B, menu -42 B, table +11 B, Markdown +122 B: verified within 3 B (measured +72, +54, -44, +12, +119).
  • Description evidence: the suites, the plain-Node load test, tsc, the 'use client' check, the knowledge check and prettier pass: verified (the touched suites and the load test pass here; CI's typecheck, lint, node and UI test jobs pass on this head; the knowledge check, prettier and the 'use client' check passed in the earlier run on this same head).
  • Description evidence: preflight and three browser specs at an earlier revision: not checked (an earlier revision).
  • Description credit: the commits carry a co-author trailer for the original design's author: verified.

Files:

  • .changeset/theme-reduced-motion-mark-reach.md: clear.
  • docs/specs/AST-108-theme-motion/spec.md: clear (new FR6 sentence, owner-approved at this head).
  • packages/core/src/privateAttributes/reducedMotion.stylex.ts: reads the top window, so the layout glide cannot use it (non-blocking).
  • packages/core/src/motion/animator.ts: stale doc comment (non-blocking).
  • packages/core/src/motion/reducedMotion.ts: clear.
  • packages/core/src/theme/Theme.tsx: clear.
  • packages/core/src/Chat/useChatStreamScroll.ts: clear.
  • packages/core/src/hooks/useStreamingText.ts: clear.
  • packages/core/src/theme/themeReducedMotionReaders.test.tsx: clear.
  • packages/core/src/Chat/useChatStreamScroll.test.tsx: clear.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 21, 2026 15:26

@rubyycheung rubyycheung left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Design approval for the reduced-motion reader plumbing. Compared the exact base and this head: normal streaming and the existing system Reduce Motion behavior are unchanged. With a test-only internal reduced-motion signal, the streaming hook shows the full text immediately. This does not enable a public always-reduced theme option; the remaining reader follow-up must precede that enablement. Desktop Chromium comparison, not full CI or independent chat-scroll validation.

@cixzhang
cixzhang marked this pull request as draft November 22, 2026 04:57
@github-actions github-actions Bot removed the needs:design-review Affects visuals — Design should review label Nov 22, 2026
@cixzhang

Copy link
Copy Markdown
Contributor Author

/approve-spec b312f7b

@astracat-bot astracat-bot Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved: CI passed on this head. The theme context and the two hook readers fit the theme-motion spec and change nothing for anyone today, and the new spec sentence has an engineering owner's approval at this head.

Non-blocking notes:

  • Miss: the layout glide still decides Reduce Motion with its own copy of the rule (motion/animatedLayout.ts:234-236), reading the element's own window, while reducesMotion reads the top window; having reducesMotion read the element's ownerDocument.defaultView would let the glide call it, here or in the follow-up.
  • defaultPrefersReducedMotion's doc comment (motion/animator.ts:1213-1221) still says the animator uses it by default, which is no longer true.

The smaller notes: the owner module's new context is not on the public-component-api record's list of owner exports, scripts/motion-node-load.test.mjs still says the foundation loads without React, and the description has no writing-rubric results for the record edit.

Claims and files checked

Review mode: same-head; reason: none

Claims:

  • Changeset: a theme's 'always' reaches hooks that hold no element through a Theme context, and a nested theme keeps an ancestor's: verified (theme/Theme.tsx:432, :521-524; reader tests).
  • Changeset: the new hook reads that context beside the person's setting: verified (privateAttributes/reducedMotion.stylex.ts:92-95).
  • Changeset: the chat scroll and streaming text read it: verified (Chat/useChatStreamScroll.ts:273, hooks/useStreamingText.ts:180).
  • Changeset: the swipe settle and the animator already read the mark: verified (Swipe/useSwipeAction.ts:1090; motion/animator.ts:1364).
  • Changeset: Carousel, BottomSheet, MobileNav, AppShell, the keyboard scroll, press feedback and Resizable follow in a separate change: verified, each still reads the setting alone.
  • Changeset and description: no theme can set 'always' yet, so nothing changes for anyone: verified (theme/motionKnobs.ts:82).
  • Description: re-ported onto current main, which already carries the mark's module, the root and wrapper marks and the animator's read: verified on the base.
  • Description: the stacked follow-up moves the other script readers: another pull request, not checked; its list leaves out Resizable, which the changeset names.
  • Description: a swipe row's settle, the animator and the layout glide already read the mark on main: verified on the base (Swipe/useSwipeAction.ts:1090, motion/animatedLayout.ts:236).
  • Description: no API change for app builders: verified (no added, changed or removed public rows in any published package).
  • Description: maintainers get one rule, reducesMotion(element) and useReducesMotion() in the owner module: verified for every file this change touches; the layout glide keeps its own copy (non-blocking note above).
  • Description: the owner module starts with 'use client', holds the shared context and both readers, and loads no animator, theme or StyleX module: verified (:3, :66-95; its imports at :20-22).
  • Description: the motion foundation still loads in plain Node: verified (its load test passes at this head).
  • Description: Theme provides the context from its own or an ancestor's 'always', and reducedMotionFade calls the same reducesMotion: verified (theme/Theme.tsx:521-524, motion/reducedMotion.ts:88).
  • Description: the animator decides with reducesMotion(target) and defaultPrefersReducedMotion delegates to it, so one copy remains: verified for the animator (motion/animator.ts:1222-1223, :1364).
  • Description: the two hooks read useReducesMotion() in place of the media query alone: verified.
  • Description: the theme-motion spec's FR6 gains one sentence naming where script readers decide: verified, with an engineering owner's approval at this head.
  • Description: no new module and no marker class: verified (no new source file).
  • Description: the earlier findings are addressed (new modules gone, first-load size, a record for the rule, a shared context, twin and guard changes gone, no swipe change needed): verified.
  • Description evidence: the reader and chat tests cover the hook, nesting, streaming text, a server render and the chat jump with the setting off: verified (they pass at this head).
  • Description evidence: red first, five of these cases fail on main: verified in direction; six fail on the base, the sixth being the control case, which fails there only because the hook is new.
  • Description evidence: first-load gzip docs +72 B, form +56 B, menu -42 B, table +11 B, Markdown +122 B: verified within 3 B (measured +72, +54, -44, +12, +119).
  • Description evidence: the suites, the plain-Node load test, tsc, the 'use client' check, the knowledge check and prettier pass: verified for the reduced-motion, theme-mark, reader, chat, streaming-text and shared-context suites and the load test at this head, and this head's CI run passed.
  • Description evidence: preflight and three browser specs at an earlier revision: not checked (an earlier revision).
  • Description credit: the commits carry a co-author trailer for the original design's author: verified.

Files:

  • .changeset/theme-reduced-motion-mark-reach.md: clear.
  • docs/specs/AST-108-theme-motion/spec.md: clear (new FR6 sentence, owner-approved at this head).
  • packages/core/src/privateAttributes/reducedMotion.stylex.ts: reads the top window, so the layout glide cannot use it (non-blocking).
  • packages/core/src/motion/animator.ts: stale doc comment (non-blocking).
  • packages/core/src/motion/reducedMotion.ts: clear.
  • packages/core/src/theme/Theme.tsx: clear.
  • packages/core/src/Chat/useChatStreamScroll.ts: clear.
  • packages/core/src/hooks/useStreamingText.ts: clear.
  • packages/core/src/theme/themeReducedMotionReaders.test.tsx: clear.
  • packages/core/src/Chat/useChatStreamScroll.test.tsx: clear.

Automated review (maintainer link)

@cixzhang
cixzhang marked this pull request as ready for review November 22, 2026 05:20
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Nov 22, 2026
@github-actions
github-actions Bot requested a review from rubyycheung November 22, 2026 05:20
cixzhang added a commit that referenced this pull request Nov 22, 2026
…0/reduced-motion-transform-transitions

Conflicts: MultiSelector imports (both kept); OverlayScrim, where main
added clip-path to the transition: each fade duration and the clip's hide
delay read the reduced-motion factor, so the mark matches the setting.
@cixzhang
cixzhang merged commit b8d2104 into main Nov 22, 2026
157 checks passed
cixzhang added a commit that referenced this pull request Nov 22, 2026
Main's #9763 changed defaultPrefersReducedMotion to answer with
reducesMotion(); this branch moved that function to motion/motionQueries.ts,
so its new body is carried there by hand, with a unit test that fails on the
old body. reducedMotion.ts reads defaultIsCoarsePointer from motionQueries,
never the animator. AST-094 keeps this branch's FR44 row and BottomSheet
keeps both FR19 (this branch) and FR27 (main); the three records take the
repository's Prettier.
cixzhang added a commit that referenced this pull request Nov 22, 2026
…me's reducedMotion 'always' (#13138)

* refactor(core): a theme's reduced-motion mark, internal until 'always' ships

Plumbing for spec:AST-108 FR6, with no change for anyone today: no public
theme can set reducedMotion, and resolveKnobs still resolves every theme to
'system', so no theme marks its root.

- privateAttributes/reducedMotion.stylex.ts owns data-astryx-reduced-motion:
  reducedMotionMarkProps and setRootReducedMotionMark write it, and
  themeReducesMotion reads it on an element, an ancestor, or <html>.
- Theme marks its wrapper, and the root theme marks <html>, with the
  attribute and the --_astryx-reduced-motion custom property when the
  theme's motion resolves reducedMotion to 'always'. The server renders the
  mark.
- The animator, reducedMotionFade and the layout glide count the mark as the
  person's Reduce Motion setting.
- ThemeReducedMotion (internal) widens to 'system' | 'always'.

Tests cover the reader, the three readers' use of it, and the Theme mark
through a mocked resolveMotionKnobs.

Co-authored-by: Christopher Chedeau <[email protected]>

* chore: a changeset for the internal reduced-motion mark; keep unrelated formatting out

* docs(Theme): say why no theme marks its root, in the present tense

* refactor(core): the reduced-motion mark carries a marker of its own, and the chat scroll, streaming text and swipe settle read it

Internal, like the mark it builds on: no theme can set reducedMotion
'always' yet, so nothing changes for anyone.

- theme/reducedMotion.markers.stylex.ts defines reducedMotionScope. Theme
  puts it on the marked wrapper, and the root theme writes its class on
  <html> beside the mark, so a Reduce Motion style keyed on
  stylex.when.ancestor('[data-astryx-reduced-motion]', reducedMotionScope)
  reaches portaled layers.
- motion/reducedMotion.ts adds reducesMotion(element): the person's setting
  or the mark. hooks/useReducesMotion.ts is its hook form, for a hook that
  holds no element: the setting, followed live, or the theme tree through
  ThemeReducesMotionContext, where a nested theme never removes an
  ancestor's 'always'.
- useChatStreamScroll, useStreamingText and ItemSwipeLayer read them.
- motion/reducedMotion.test.ts guards the rest with lists that only shrink:
  every Reduce Motion arm needs its twin on the mark, and every script read
  of the setting needs the mark. A read through a constant that holds the
  query counts.
- Tests reach 'always' through a themeMotion mock
  (theme/reducedMotionAlways.testing.ts).

Co-authored-by: Christopher Chedeau <[email protected]>

* test: the motion foundation may read a private attribute's owner module that calls no StyleX

The animator reads the reduced-motion mark through its owner module, which
the private-attribute rule names .stylex.ts. The module imports nothing, and
the check that the graph reaches no @stylexjs import still holds it to that.

* ci: the WebKit interaction proofs cover the reduced-motion mark's owner module, which the animator reads

* Merge lane4/theme-always-mark into lane4/r8895-mark

* Merge main into lane4/r8895-mark

The old base (#9761) landed squashed, so this resolves as main plus this
branch's own changes. main's later Reduce Motion work updates the
pending lists: ClickableCard, SelectableCard, Spinner's rotor, Thumbnail,
the press module and useMobileKeyboard are listed; Lightbox, Spinner,
AppShell and MobileNav come off (main removed their arms or reads).

* refactor(core): re-port onto main: a theme's reducedMotion 'always' reaches the hooks that hold no element

Main now carries the mark's private-attribute module, the root and wrapper
marks, and the animator's read of them (#9761), so this re-port keeps only
what main lacks: Theme passes 'always' down through ThemeReducesMotionContext
(beside Theme's other contexts in useTheme.ts; a nested theme keeps an
ancestor's), and motion/reducedMotion.ts gains reducesMotion(element) and its
hook form useReducesMotion, which the chat scroll and streaming text now
read. The swipe release already reads the mark through reducedMotionFade.
The other script readers follow in a stacked change.

Co-authored-by: Christopher Chedeau <[email protected]>

* refactor(core): the remaining Reduce Motion script readers read a theme's 'always'

Carousel's button and index scrolls, BottomSheet's alignment, cross-fade,
haptic and scroll settle, MobileNav's and AppShell's close hold, the mobile
keyboard's scroll and press feedback's release now decide through
motion/reducedMotion.ts (reducesMotion or useReducesMotion), which counts a
theme's reducedMotion: 'always' mark beside the person's setting.
Resizable's close slide, a DOM-free entry, ORs the setting with the mark
through the mark's owner module, as animatedLayout does. A guard test
keeps any new script read of the setting on the same rule (spec:AST-108
FR6). Stacked on the change that adds useReducesMotion.

Co-authored-by: Christopher Chedeau <[email protected]>

* refactor(core): the reduced-motion context lives beside the mark, so the motion foundation loads in plain Node

scripts/motion-node-load.test.mjs requires the motion foundation to reach no
theme module and no StyleX module. motion/reducedMotion.ts now reads
ThemeReducesMotionContext from privateAttributes/reducedMotion.stylex.ts, the
mark's owner module, which calls no StyleX, instead of theme/useTheme.ts.
reducedMotion.ts holds a hook, so it starts with 'use client'.

* Merge branch 'lane4/r8895-mark' into l0/reduced-motion-script-readers

* refactor(core): the script readers' rule lives in the mark's owner module, which loads no animator

motion/reducedMotion.ts imports the animator, so a reader on every page
(press feedback, streaming text) would load it at first load. reducesMotion
and useReducesMotion now live in privateAttributes/reducedMotion.stylex.ts
beside the mark and its context; that module loads no animator, theme or
StyleX module. reducedMotionFade calls the same reducesMotion. spec:AST-108
FR6 gains the sentence that script readers decide through that module.
First-load gzip against main: docs +72 B, form +56 B, menu -42 B, table
+11 B, a Markdown page +122 B.

* refactor(core): the remaining readers decide through the mark's owner module; a tighter guard; BottomSheet and Resizable tests

Every reader in this change now imports reducesMotion or useReducesMotion
from privateAttributes/reducedMotion.stylex.ts (merged from the base), which
loads no animator, so press feedback and Carousel no longer pull the
animator into first-load JavaScript. Resizable calls reducesMotion too, so
its inline copies go. The guard now counts each listed file's spellings of
the setting's query and fails any call of the animator's setting-only read
outside the motion foundation. BottomSheet (a coarse pointer's fade, no
alignment travel) and Resizable (no spring-back past the maximum) gain tests
under a theme's 'always' with the setting off. snap-paging's pager-only list
no longer holds the owner module, which every reader loads. spec:AST-108's
verification table names the guard. First-load gzip against main for the
stack: docs +74 B, form +24 B, menu +64 B, table +108 B.

* test(core): the reduced-motion guard matches the setting's query in any quote style and the exported query constants

The guard counted only a single-quoted query, so a template-literal read
or a read through REDUCED_MOTION_FADE_QUERY, REDUCED_MOTION_INSTANT_QUERY
or REDUCED_MOTION_COARSE_QUERY passed it. It now matches the query in any
quote style and fails any use of those constants outside the file that owns
each. The animator's entry leaves the allow-list (it reads through
reducesMotion now). AST-108's verification row and the changeset say so.

* refactor(core): the animator decides Reduce Motion through the same reducesMotion

The animator kept its own copy of the rule (the setting, or the mark on the
target). It now calls reducesMotion(target) from the mark's owner module,
and defaultPrefersReducedMotion delegates to reducesMotion(), so one rule
remains. The changeset's list of readers that follow names Resizable.

* test(core): the reduced-motion guard matches the setting's query inside a longer quoted query

A reader that spells '(pointer: fine) and (prefers-reduced-motion: reduce)'
passed the guard, which matched only a quote directly before the setting's
query. It now matches the setting's query anywhere inside a quoted string.

* Merge branch 'main' into lane4/r8895-mark

* Merge main into lane4/r8895-mark

* Merge #9763's head (main merge) into l0/reduced-motion-script-readers

* fix(core): one reduced-motion rule for the glide and the Dialog entrance

After the main merge: main's Dialog reads the setting's query itself, which
the readers guard refuses. It now asks reducesMotion(dialog), and watches
the setting through the owner module's new watchReduceMotionSetting only
while it is open under the setting (a theme's mark does not end).
reducesMotion reads the element's own window, so the layout glide calls it
instead of its own copy of the rule. The defaultPrefersReducedMotion
comment says it is the setting alone. Folds in #9763's review notes.

* test(motion): the readers guard allows the layout glide no spelling

The glide calls reducesMotion(area), so its allowance is unused; without
it, moving the glide back to the setting alone fails the guard. Comments
say a theme's mark is not watched, instead of that it does not change.

* Merge branch 'main' into l0/reduced-motion-script-readers

main holds #9763's squash, whose files equal its b312f7b head; the
owner module keeps this branch's version.

* fix(Dialog): the entrance stays still if the theme reduces motion when the setting ends

The setting watcher asks the theme's mark again before it replays the
travelling entrance.

* refactor(BottomSheet): the coarse cross-fade reads the owner module's rule once

Folds in review notes. useReducesMotion already includes the setting, so
the panel's cross-fade is reduced motion on a coarse pointer, and the
setting-only query goes; the readers guard drops BottomSheetPanel's
allowance and constant. The Dialog comment says the entrance replays only
when no theme's mark holds.

* test(motion): the readers guard catches reducesMotion with no element

A reducesMotion() call with no element reads the setting alone; only the
animator's setting-only read may make it.

* test(Dialog): pin the entrance's two theme-mark branches

Folds in review notes: under a theme's reduced-motion mark the dialog
reads no opener, and with the setting on too it watches no setting. The
Carousel's local is named for what it holds (setting or mark).

* test(Dialog): pin the re-check before a replayed entrance

When the setting ends after a theme's mark appeared, the entrance stays
still. The case fails without the re-check.

* test(Resizable): the 'always' spring-back case reads only frames after the lift

In WebKit a frame can run between the start of the recording and the
lift's dispatch; that frame still shows the edge past the limit. Each
recorded frame now says whether the page had heard the pointer's lift,
and the case checks only those.

* Merge branch 'main' into l0/reduced-motion-script-readers
@github-actions
github-actions Bot deleted the lane4/r8895-mark branch November 23, 2026 06:06
cixzhang added a commit that referenced this pull request Nov 25, 2026
…rom the setting or a theme (#13512)

* refactor(core): a theme's reduced-motion mark, internal until 'always' ships

Plumbing for spec:AST-108 FR6, with no change for anyone today: no public
theme can set reducedMotion, and resolveKnobs still resolves every theme to
'system', so no theme marks its root.

- privateAttributes/reducedMotion.stylex.ts owns data-astryx-reduced-motion:
  reducedMotionMarkProps and setRootReducedMotionMark write it, and
  themeReducesMotion reads it on an element, an ancestor, or <html>.
- Theme marks its wrapper, and the root theme marks <html>, with the
  attribute and the --_astryx-reduced-motion custom property when the
  theme's motion resolves reducedMotion to 'always'. The server renders the
  mark.
- The animator, reducedMotionFade and the layout glide count the mark as the
  person's Reduce Motion setting.
- ThemeReducedMotion (internal) widens to 'system' | 'always'.

Tests cover the reader, the three readers' use of it, and the Theme mark
through a mocked resolveMotionKnobs.

Co-authored-by: Christopher Chedeau <[email protected]>

* chore: a changeset for the internal reduced-motion mark; keep unrelated formatting out

* docs(Theme): say why no theme marks its root, in the present tense

* refactor(core): the reduced-motion mark carries a marker of its own, and the chat scroll, streaming text and swipe settle read it

Internal, like the mark it builds on: no theme can set reducedMotion
'always' yet, so nothing changes for anyone.

- theme/reducedMotion.markers.stylex.ts defines reducedMotionScope. Theme
  puts it on the marked wrapper, and the root theme writes its class on
  <html> beside the mark, so a Reduce Motion style keyed on
  stylex.when.ancestor('[data-astryx-reduced-motion]', reducedMotionScope)
  reaches portaled layers.
- motion/reducedMotion.ts adds reducesMotion(element): the person's setting
  or the mark. hooks/useReducesMotion.ts is its hook form, for a hook that
  holds no element: the setting, followed live, or the theme tree through
  ThemeReducesMotionContext, where a nested theme never removes an
  ancestor's 'always'.
- useChatStreamScroll, useStreamingText and ItemSwipeLayer read them.
- motion/reducedMotion.test.ts guards the rest with lists that only shrink:
  every Reduce Motion arm needs its twin on the mark, and every script read
  of the setting needs the mark. A read through a constant that holds the
  query counts.
- Tests reach 'always' through a themeMotion mock
  (theme/reducedMotionAlways.testing.ts).

Co-authored-by: Christopher Chedeau <[email protected]>

* test: the motion foundation may read a private attribute's owner module that calls no StyleX

The animator reads the reduced-motion mark through its owner module, which
the private-attribute rule names .stylex.ts. The module imports nothing, and
the check that the graph reaches no @stylexjs import still holds it to that.

* ci: the WebKit interaction proofs cover the reduced-motion mark's owner module, which the animator reads

* Merge lane4/theme-always-mark into lane4/r8895-mark

* Merge main into lane4/r8895-mark

The old base (#9761) landed squashed, so this resolves as main plus this
branch's own changes. main's later Reduce Motion work updates the
pending lists: ClickableCard, SelectableCard, Spinner's rotor, Thumbnail,
the press module and useMobileKeyboard are listed; Lightbox, Spinner,
AppShell and MobileNav come off (main removed their arms or reads).

* refactor(core): re-port onto main: a theme's reducedMotion 'always' reaches the hooks that hold no element

Main now carries the mark's private-attribute module, the root and wrapper
marks, and the animator's read of them (#9761), so this re-port keeps only
what main lacks: Theme passes 'always' down through ThemeReducesMotionContext
(beside Theme's other contexts in useTheme.ts; a nested theme keeps an
ancestor's), and motion/reducedMotion.ts gains reducesMotion(element) and its
hook form useReducesMotion, which the chat scroll and streaming text now
read. The swipe release already reads the mark through reducedMotionFade.
The other script readers follow in a stacked change.

Co-authored-by: Christopher Chedeau <[email protected]>

* refactor(core): the remaining Reduce Motion script readers read a theme's 'always'

Carousel's button and index scrolls, BottomSheet's alignment, cross-fade,
haptic and scroll settle, MobileNav's and AppShell's close hold, the mobile
keyboard's scroll and press feedback's release now decide through
motion/reducedMotion.ts (reducesMotion or useReducesMotion), which counts a
theme's reducedMotion: 'always' mark beside the person's setting.
Resizable's close slide, a DOM-free entry, ORs the setting with the mark
through the mark's owner module, as animatedLayout does. A guard test
keeps any new script read of the setting on the same rule (spec:AST-108
FR6). Stacked on the change that adds useReducesMotion.

Co-authored-by: Christopher Chedeau <[email protected]>

* refactor(core): the reduced-motion context lives beside the mark, so the motion foundation loads in plain Node

scripts/motion-node-load.test.mjs requires the motion foundation to reach no
theme module and no StyleX module. motion/reducedMotion.ts now reads
ThemeReducesMotionContext from privateAttributes/reducedMotion.stylex.ts, the
mark's owner module, which calls no StyleX, instead of theme/useTheme.ts.
reducedMotion.ts holds a hook, so it starts with 'use client'.

* Merge branch 'lane4/r8895-mark' into l0/reduced-motion-script-readers

* refactor(core): the script readers' rule lives in the mark's owner module, which loads no animator

motion/reducedMotion.ts imports the animator, so a reader on every page
(press feedback, streaming text) would load it at first load. reducesMotion
and useReducesMotion now live in privateAttributes/reducedMotion.stylex.ts
beside the mark and its context; that module loads no animator, theme or
StyleX module. reducedMotionFade calls the same reducesMotion. spec:AST-108
FR6 gains the sentence that script readers decide through that module.
First-load gzip against main: docs +72 B, form +56 B, menu -42 B, table
+11 B, a Markdown page +122 B.

* refactor(core): the remaining readers decide through the mark's owner module; a tighter guard; BottomSheet and Resizable tests

Every reader in this change now imports reducesMotion or useReducesMotion
from privateAttributes/reducedMotion.stylex.ts (merged from the base), which
loads no animator, so press feedback and Carousel no longer pull the
animator into first-load JavaScript. Resizable calls reducesMotion too, so
its inline copies go. The guard now counts each listed file's spellings of
the setting's query and fails any call of the animator's setting-only read
outside the motion foundation. BottomSheet (a coarse pointer's fade, no
alignment travel) and Resizable (no spring-back past the maximum) gain tests
under a theme's 'always' with the setting off. snap-paging's pager-only list
no longer holds the owner module, which every reader loads. spec:AST-108's
verification table names the guard. First-load gzip against main for the
stack: docs +74 B, form +24 B, menu +64 B, table +108 B.

* test(core): the reduced-motion guard matches the setting's query in any quote style and the exported query constants

The guard counted only a single-quoted query, so a template-literal read
or a read through REDUCED_MOTION_FADE_QUERY, REDUCED_MOTION_INSTANT_QUERY
or REDUCED_MOTION_COARSE_QUERY passed it. It now matches the query in any
quote style and fails any use of those constants outside the file that owns
each. The animator's entry leaves the allow-list (it reads through
reducesMotion now). AST-108's verification row and the changeset say so.

* refactor(core): the animator decides Reduce Motion through the same reducesMotion

The animator kept its own copy of the rule (the setting, or the mark on the
target). It now calls reducesMotion(target) from the mark's owner module,
and defaultPrefersReducedMotion delegates to reducesMotion(), so one rule
remains. The changeset's list of readers that follow names Resizable.

* test(core): the reduced-motion guard matches the setting's query inside a longer quoted query

A reader that spells '(pointer: fine) and (prefers-reduced-motion: reduce)'
passed the guard, which matched only a quote directly before the setting's
query. It now matches the setting's query anywhere inside a quoted string.

* Merge branch 'main' into lane4/r8895-mark

* fix(core): transform transitions land at once under reduced motion, from the setting or a theme

One shared helper, privateAttributes/transformMotion.stylex.ts, gives a
transform's duration a factor that reads the --_astryx-reduced-motion
property Theme writes where it writes the reduced-motion mark, and the
media key for the person's setting. 30 transform transitions build their
durations from it: chevrons that turned even under the setting now land
at once, and the sites that only followed the media query now follow a
theme that reduces motion for everyone too. Colour and opacity keep their
durations. A Chromium spec sweeps eight stories under no reduction, the
setting, a nested marked theme and a marked root.

* fix(core): the reduced-motion transform factor lives in motion/reducedMotion.stylex.ts

CodeBunny review: fold the helper into the existing CSS-side module of the
Reduced Motion policy (reducedMotionTransform: factor, settle) instead of
a new module; spell the setting's media key literally at each site; the
resize handle's pill changes every property at once under the setting
(DR3), and the mark matches. Stepper's per-connector timing reads
useReducesMotion in script instead of a calc, so its timing tests keep
their values. Tests that pin a duration string are updated, and the
changeset says no theme can set reducedMotion 'always' yet.

* fix(BottomSheet): under a theme that reduces motion, the sheet lands on the next frame

PR Review's motion check: with the 0.01s settle, the sheet's entrance
from its @starting-style offset showed one frame between. The sheet's own
wait resolves a zero duration, so it takes the factor alone (0s under
the mark), as the setting's arm already lands in one frame.

* test(TreeList): with a mouse under reduced motion, the chevron lands at once

The test asserted a chevron turn under Reduce Motion that no record
grants; design:reduced-motion DR1 and DR3 govern (a rotation is
movement, and with a fine pointer it completes at once). Ruled by the
Specification session. The group's at-once assertion stays.

* Merge main into lane4/r8895-mark

* Merge #9763's head (main merge) into l0/reduced-motion-script-readers

* Merge l0/reduced-motion-script-readers (on #9763's main merge) into l0/reduced-motion-transform-transitions

Conflicts: MultiSelector imports (both kept); OverlayScrim, where main
added clip-path to the transition: each fade duration and the clip's hide
delay read the reduced-motion factor, so the mark matches the setting.

* Merge l0/reduced-motion-script-readers into l0/reduced-motion-transform-transitions

* fix(core): one reduced-motion rule for the glide and the Dialog entrance

After the main merge: main's Dialog reads the setting's query itself, which
the readers guard refuses. It now asks reducesMotion(dialog), and watches
the setting through the owner module's new watchReduceMotionSetting only
while it is open under the setting (a theme's mark does not end).
reducesMotion reads the element's own window, so the layout glide calls it
instead of its own copy of the rule. The defaultPrefersReducedMotion
comment says it is the setting alone. Folds in #9763's review notes.

* fix(Dialog, Overlay): a reduced-motion theme shows the dialog and lifts the scrim clip at once

The Dialog's entrance keyframes take the reduced-motion factor on their
duration, so under a theme's 'always' the dialog appears at once (DR3),
as under the setting. The scrim's hover clip delay takes it too, so the
reveal settles in one frame.

* test(motion): the readers guard allows the layout glide no spelling

The glide calls reducesMotion(area), so its allowance is unused; without
it, moving the glide back to the setting alone fails the guard. Comments
say a theme's mark is not watched, instead of that it does not change.

* Merge l0/reduced-motion-script-readers into l0/reduced-motion-transform-transitions

* Merge branch 'main' into l0/reduced-motion-script-readers

main holds #9763's squash, whose files equal its b312f7b head; the
owner module keeps this branch's version.

* fix(Dialog): the entrance stays still if the theme reduces motion when the setting ends

The setting watcher asks the theme's mark again before it replays the
travelling entrance.

* Merge l0/reduced-motion-script-readers (on main) into l0/reduced-motion-transform-transitions

* Merge l0/reduced-motion-script-readers into l0/reduced-motion-transform-transitions

* refactor(BottomSheet): the coarse cross-fade reads the owner module's rule once

Folds in review notes. useReducesMotion already includes the setting, so
the panel's cross-fade is reduced motion on a coarse pointer, and the
setting-only query goes; the readers guard drops BottomSheetPanel's
allowance and constant. The Dialog comment says the entrance replays only
when no theme's mark holds.

* docs(BottomSheet): shorten the reduced-motion settle comment

* test(motion): the readers guard catches reducesMotion with no element

A reducesMotion() call with no element reads the setting alone; only the
animator's setting-only read may make it.

* Merge l0/reduced-motion-script-readers into l0/reduced-motion-transform-transitions

* test(Dialog): pin the entrance's two theme-mark branches

Folds in review notes: under a theme's reduced-motion mark the dialog
reads no opener, and with the setting on too it watches no setting. The
Carousel's local is named for what it holds (setting or mark).

* Merge l0/reduced-motion-script-readers into l0/reduced-motion-transform-transitions

* test(Dialog): pin the re-check before a replayed entrance

When the setting ends after a theme's mark appeared, the entrance stays
still. The case fails without the re-check.

* Merge l0/reduced-motion-script-readers into l0/reduced-motion-transform-transitions

* test(Resizable): the 'always' spring-back case reads only frames after the lift

In WebKit a frame can run between the start of the recording and the
lift's dispatch; that frame still shows the edge past the limit. Each
recorded frame now says whether the page had heard the pointer's lift,
and the case checks only those.

* Merge l0/reduced-motion-script-readers into l0/reduced-motion-transform-transitions

* Merge branch 'main' into l0/reduced-motion-script-readers

* Merge l0/reduced-motion-script-readers into l0/reduced-motion-transform-transitions

* Merge branch 'main' into l0/reduced-motion-transform-transitions

* Merge branch 'main' into l0/reduced-motion-transform-transitions

* Merge branch 'main' into l0/reduced-motion-transform-transitions

* Merge branch 'main' into l0/reduced-motion-transform-transitions

This branch was successfully deployed

1 active deployment
Preview — b312f7ba Deployed Nov 22, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) CLA Signed This label is managed by the Meta Open Source bot. lane:0 Astryx fix-loop lane 0 owns this needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants