Skip to content

fix(core): a button's touch press release runs on the compositor - #9783

Merged
cixzhang merged 5 commits into
mainfrom
fix/control-press-release-compositor
Nov 6, 2026
Merged

cixzhang merged 5 commits into
mainfrom
fix/control-press-release-compositor

Conversation

@cixzhang

@cixzhang cixzhang commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Supersedes #8118 by @vjeux, rebuilt on main after the press chain (#9758, #9762, #9765, #9890) merged. The change is vjeux's: his commit authorship is kept, and the changeset credits him.

User impact

This affects people who tap a button on a touch-first device: Button, and the IconButton and ToggleButton built on it.

  • Today: a tap usually starts work, so the main thread is busiest just after the lift. The release animates a gradient strength that only the main thread can repaint, so the press stays at full strength while script runs, then snaps off.
  • After this change: under a coarse primary pointer the release is an opacity animation, which engines run on the compositor. It keeps fading while script runs, and paints nothing per frame. Its timing is unchanged: the theme's exit motion tokens, as on main.
  • Unchanged: any other pointer, a finger on a touch screen beside a mouse included, keeps the press it has today: no layer, no isolation, the strength's own release.

Rebase onto main (card 78 pass carry-over)

Cindy passed card 78 at 9c24db4. This head is rebuilt on main after #10085, which lets swizzle copy the private attribute owner module Button now imports. The range-diff of this pull request's own change, from 9c24db4 to this head:

  • privateAttributes/press.stylex.ts: the file header names main's new rowPressPaintStyles beside this change's controlPressLayerStyles, and controlPressLayerStyles sits before that export at the end of the file. The styles are unchanged.
  • ButtonPressRelease.interaction.browser.spec.ts, test only: the "after a busy first frame" case sets a 400 ms exit duration on the button, so the release outlasts the 150 ms block in both engines. Its first-frame bound runs only outside WebKit, because WebKit starts the release at the time the busy script began, as main's ListRowPress case records. The "keeps the layer until its strength reaches 0" check runs in both engines.
  • Every other file: a byte-identical diff. No product code changed.

Checks at this head: 1,766 focused tests (Button, Item, List, TreeList, CheckboxList, IconButton, ToggleButton, ButtonGroup, utils, the swizzle API and the stylesheet test), strict lint, the core type check, the private-attribute baseline and check:changesets all pass.

Problem and solution fit

  1. Why it occurs: the press strength is a custom property feeding a gradient, repainted on the main thread.
  2. Why it harms: a tap starts work, so the thread is busiest then.
  3. Why it matters: the release confirms the tap; frozen, it reads as lag.

Under a coarse primary pointer, Button composes the list row's compositor press layer (rowPressLayerStyles.cell and cellOnImage in privateAttributes/press.stylex.ts), so one set of styles serves both, and adds only a will-change: transform (controlPressLayerStyles.control) so its press-scale transition does not repaint at its end. The layer, isolation and will-change exist only while a press is on or fading, under a coarse pointer only. The layer releases on the row layer's clock and curve, var(--duration-exit) with var(--ease-exit), and min(var(--duration-exit), 200ms) under Reduce Motion. No new constant. The press controller ends the press when the layer's release animation has played.

Changes since #8118

main and Specs & Decisions' rulings changed what this pull request carries:

Expected behavior and authority

component:Button FR15 gains Specs' line: "Under a coarse pointer, while a press is on or fading, Button paints the press on its own ::before; a caller's ::before styles apply on top of that layer and win where they overlap, so a decoration that must stay through a touch press belongs on a child element." Cindy's 10-25 ruling allows Button's ::before on touch. spec:AST-094 FR5 requires the compositor release and the exit motion tokens. design:user-states DR1 and DR5. A fine pointer is unchanged (spec:AST-017 FR59).

Verification

  • Unit, red first: Button's touch press is on a compositor layer that releases on the exit clock, and Button has no layer and no isolation at rest. Both fail on main and pass here.
  • Guards: a fine pointer keeps the strength's release (keepsPressOutsideCoarse), and an Item row keeps its layer to a press.
  • Suites: Button, IconButton, ToggleButton, ButtonGroup, Item, List, TreeList, utils and the stylesheet test pass (1,405 tests). So do strict lint, the core type check, the private-attribute baseline check and check:changesets.
  • Real Chromium (phone viewport with touch): ButtonPressRelease, ButtonPressTiming, ButtonPress and ListRowPress pass 29 of 29, with 1 skipped (a WebKit-only case), in 3 of 3 runs. The browser specs read the release clock and curve from the page's --duration-exit and --ease-exit, so they follow the theme. The exit curve leaves fastest at its end, so the "at rest" checks allow one frame before the end. The blocked-main-thread proof sets a 400 ms exit duration on the button, so the block spans enough frames to judge. On the base before this change, the ButtonPressRelease layer cases fail, because Button has no ::before layer there.
  • On a phone: a new phone-gate card at this head.

Scope

  • One defect is restored, for Button.
  • No new public API; the release keeps the theme's exit timing.
  • Public text and artifacts contain no internal Meta context.

Writing rubric results

R1 narration: FR15's added sentence states the system in the present tense.
R2 research: none in the record.
R3 evidence: none changed.
R4 rejected alternatives: none added.
R5 change references: none.
R6 open questions: none added.

@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 6, 2026 1:55am UTC

Request Review

@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 6, 2026, 2:10 AM UTC

@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 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.

The compositor release works as described in Chromium and keeps its clock and curve. Approval waits on one spec decision and three fixes.

Spec decision needed: no current record says Button may take its own ::before during a touch press, and that changes what a caller's ::before styles render. An engineering owner needs to provide or identify the governing clause (for example in component:Button) and records the decision by commenting /approve-spec <full head SHA> on this pull request; the author may do so if they are an engineering owner.

Required fixes:

  • Nest willChange under @media (pointer: coarse) in controlPressLayerStyles.control (privateAttributes/press.stylex.ts:302), because a pen or finger press on a fine-pointer device now gets will-change: transform, against spec:AST-017 FR59 and the changeset's "nothing changes".
  • Drop expect(state.press).toBeNull() from the fine-pointer mouse test (ButtonPressRelease.interaction.browser.spec.ts:376), because component:Button FR15 routes a mouse press through the press controller and the assertion pins that recorded gap as a rule.
  • Build Button's layer from one shared press-layer style with the rows instead of copying rowPressLayerStyles.cell and cellOnImage, keeping only Button's own coarse-guarded willChange (and later its clock) in control.

[Automated review]

// for it and drops that layer at its end, which repaints the button. A
// layer kept from the touch to the end of the release keeps the release
// free of Paint.
willChange: {default: null, [PRESSED_ANY]: 'transform'},

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.

This is the only control arm outside @media (pointer: coarse). The controller writes the press state for every non-mouse pointer, so on a fine-pointer device a pen or finger press now gets will-change: transform (a stacking context and a compositing layer for the press). That goes against spec:AST-017 FR59 and the changeset's "nothing changes".

willChange: {default: null, [COARSE]: {default: null, [PRESSED_ANY]: 'transform'}},

keepsPressOutsideCoarse could also reject will-change outside the coarse query, so the guard catches this.

expect(['none', 'normal'], JSON.stringify(state)).toContain(state.layer);
expect(state.isolation).toBe('auto');
// A mouse's press is `:active`'s: the controller writes nothing.
expect(state.press).toBeNull();

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.

component:Button FR15 says a press paints "through the press controller: at once under a mouse or a pen", and Button's Current-state impact lists the mouse path as not yet implemented. This assertion turns that gap into "the desktop rule", so whoever implements the mouse path gets a failing test. The layer and isolation checks above already prove this test's point, so this line can go.

* rest, and with any other pointer, nothing here applies: no layer, no
* `isolation`, and the variant's own paint and release, as before.
*/
control: {

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.

control repeats rowPressLayerStyles.cell and cellOnImage property for property: the image arms, the coarse animation-name: none, isolation, the ::before box, opacity, clock and fill mode. controlRelease duplicates cellRelease. Only the ENABLED nesting and willChange are new. StyleX merges ::before properties one at a time (as cellWithoutLayer relies on), so Button could compose one shared press-layer style with the rows and keep only its own coarse-guarded willChange, and later its clock, here.

@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.

The compositor release works as described in Chromium and keeps its clock and curve. Approval waits on one spec decision and three fixes.

Spec decision needed: no current record says Button may take its own ::before during a touch press, and that changes what a caller's ::before styles render during a press (the press fill can disappear and the caller's decoration moves). An engineering owner needs to settle whether Button's component record claims that pseudo-element (or whether the press must leave a caller's ::before intact), and records the decision by commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner.

Required fixes:

  • Nest willChange under @media (pointer: coarse) in controlPressLayerStyles.control (privateAttributes/press.stylex.ts:306), because a pen or finger press on a fine-pointer device now gets will-change: transform, against spec:AST-017 FR59 and the changeset's "nothing changes".
  • Drop expect(state.press).toBeNull() from the fine-pointer mouse test (ButtonPressRelease.interaction.browser.spec.ts:376), because spec:AST-094 FR11 and DEC-21 route a mouse press through the press controller and the assertion pins Button's recorded gap as a rule.
  • Build Button's layer from the shared row press-layer styles (rowPressLayerStyles.cell and cellOnImage) instead of copying them, keeping only Button's own coarse-guarded willChange (and later its clock) in control.

[Automated review]

// for it and drops that layer at its end, which repaints the button. A
// layer kept from the touch to the end of the release keeps the release
// free of Paint.
willChange: {default: null, [PRESSED_ANY]: 'transform'},

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.

This is the only control arm outside @media (pointer: coarse). The controller writes the press state for every non-mouse pointer, so on a fine-pointer device a pen or finger press now gets will-change: transform (a stacking context and a compositing layer), against spec:AST-017 FR59 and the changeset's "nothing changes". Suggest willChange: {default: null, [COARSE]: {default: null, [PRESSED_ANY]: 'transform'}}, and have keepsPressOutsideCoarse reject will-change outside the coarse query.

expect(['none', 'normal'], JSON.stringify(state)).toContain(state.layer);
expect(state.isolation).toBe('auto');
// A mouse's press is `:active`'s: the controller writes nothing.
expect(state.press).toBeNull();

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.

spec:AST-094 FR11 says a fine pointer's press paint starts "through the same press controller" and DEC-21 says "The press controller tracks every pointer"; Button's record lists the mouse path as not yet implemented. This assertion pins that gap as a rule, so closing it fails this test. Suggest dropping it and keeping the layer and isolation checks.

* rest, and with any other pointer, nothing here applies: no layer, no
* `isolation`, and the variant's own paint and release, as before.
*/
control: {

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.

control repeats rowPressLayerStyles.cell and cellOnImage property for property (image arms, coarse animation-name: none, isolation, the ::before box, opacity, clock and fill mode), and controlRelease duplicates cellRelease. Composing Button from those styles, with only Button's coarse-guarded willChange (and later a clock override) here, keeps one path for both.

@cixzhang
cixzhang force-pushed the fix/press-touch-down-highlight branch from 1b6a265 to 3b74202 Compare November 4, 2026 14:51
@cixzhang
cixzhang force-pushed the fix/control-press-release-compositor branch from 6e6dbb6 to e483f29 Compare November 4, 2026 22:29
@cixzhang
cixzhang changed the base branch from fix/press-touch-down-highlight to main November 4, 2026 22:29
@cixzhang cixzhang changed the title fix(core): a control's press release runs on the compositor fix(core): a button's touch press release runs on the compositor Nov 4, 2026
@cixzhang

cixzhang commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec e483f29

@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Nov 4, 2026
@cixzhang
cixzhang force-pushed the fix/control-press-release-compositor branch from e483f29 to 75408a9 Compare November 4, 2026 22:48
@cixzhang

cixzhang commented Nov 4, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 75408a9

@github-actions

github-actions Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

🔎 Preview · 216d477

Storybook · Sandbox · built from this PR's head

Modified components

Component Size LoC Visual · A11y · RTL
Button · Storybook 51.4 kB (+337 B) · 9.3 kB CSS (+461 B) 662 (+7) ✓ · ✓ · ✗
Stepper 53.1 kB (+481 B) · 9.5 kB CSS (+445 B) — — · — · —
TopNav 62.9 kB (+470 B) · 10.2 kB CSS (+450 B) — — · — · —
82 more components
Component Size LoC Visual · A11y · RTL
SideNav 81.4 kB (+455 B) · 10.7 kB CSS (+447 B) — — · — · —
CodeBlock 65.9 kB (+455 B) · 10.6 kB CSS (+446 B) — — · — · —
ChatComposer 68.0 kB (+452 B) · 11.2 kB CSS (+448 B) — — · — · —
ChatComposerInput 66.0 kB (+453 B) · 10.6 kB CSS (+444 B) — — · — · —
ChatComposerTokenElement 66.0 kB (+453 B) · 10.6 kB CSS (+444 B) — — · — · —
ChatLayout 54.7 kB (+452 B) · 9.8 kB CSS (+445 B) — — · — · —
ComplexSelector 62.3 kB (+414 B) · 11.0 kB CSS (+448 B) — — · — · —
MobileNavToggle 51.8 kB (+372 B) · 9.3 kB CSS (+461 B) — — · — · —
ChatSendButton 51.8 kB (+371 B) · 9.3 kB CSS (+460 B) — — · — · —
ToggleButton 52.3 kB (+367 B) · 9.4 kB CSS (+461 B) — — · — · —
SideNavItem 61.4 kB (+368 B) · 10.4 kB CSS (+452 B) — — · — · —
IconButton 51.5 kB (+358 B) · 9.3 kB CSS (+461 B) — — · — · —
TextInput 59.2 kB (+364 B) · 10.5 kB CSS (+453 B) — — · — · —
ChatDictationButton 52.0 kB (+357 B) · 9.4 kB CSS (+458 B) — — · — · —
Tokenizer 80.1 kB (+360 B) · 17.8 kB CSS (+455 B) — — · — · —
TopNavMenu 65.6 kB (+363 B) · 10.5 kB CSS (+452 B) — — · — · —
Typeahead 69.7 kB (+375 B) · 11.8 kB CSS (+437 B) — — · — · —
DateRangeInput 81.2 kB (+373 B) · 11.8 kB CSS (+436 B) — — · — · —
AppShell 81.3 kB (+359 B) · 12.8 kB CSS (+446 B) — — · — · —
Banner 53.4 kB (+356 B) · 9.8 kB CSS (+449 B) — — · — · —
TopNavHeading 65.8 kB (+355 B) · 10.4 kB CSS (+448 B) — — · — · —
SideNavCollapseButton 52.3 kB (+344 B) · 9.4 kB CSS (+458 B) — — · — · —
BaseTypeahead 61.8 kB (+350 B) · 10.3 kB CSS (+449 B) — — · — · —
TopNavMegaMenu 60.7 kB (+338 B) · 11.2 kB CSS (+460 B) — — · — · —
ChatLayoutScrollButton 51.9 kB (+352 B) · 9.5 kB CSS (+445 B) — — · — · —
SideNavHeading 66.4 kB (+344 B) · 10.6 kB CSS (+452 B) — — · — · —
DateTimeInput 189.4 kB (+362 B) · 17.8 kB CSS (+432 B) — — · — · —
Calendar 62.2 kB (+351 B) · 9.9 kB CSS (+442 B) — — · — · —
Carousel 58.2 kB (+346 B) · 10.1 kB CSS (+447 B) — — · — · —
TabMenu 62.8 kB (+343 B) · 10.4 kB CSS (+450 B) — — · — · —
TimeInput 143.6 kB (+333 B) · 15.1 kB CSS (+459 B) — — · — · —
Toast 65.3 kB (+345 B) · 9.6 kB CSS (+444 B) — — · — · —
Lightbox 59.5 kB (+331 B) · 9.7 kB CSS (+456 B) — — · — · —
MobileNav 61.2 kB (+342 B) · 9.9 kB CSS (+445 B) — — · — · —
NumberInput 62.6 kB (+345 B) · 10.7 kB CSS (+442 B) — — · — · —
DateInput 166.6 kB (+341 B) · 16.1 kB CSS (+445 B) — — · — · —
DialogHeader 54.2 kB (+337 B) · 10.8 kB CSS (+449 B) — — · — · —
FileInput 60.0 kB (+347 B) · 10.3 kB CSS (+439 B) — — · — · —
DrawerHeader 54.4 kB (+327 B) · 12.2 kB CSS (+453 B) — — · — · —
Popover 60.6 kB (+335 B) · 13.4 kB CSS (+445 B) — — · — · —
TableSelectionToolbar 60.9 kB (+328 B) · 12.4 kB CSS (+449 B) — — · — · —
Thumbnail 55.8 kB (+346 B) · 10.9 kB CSS (+431 B) — — · — · —
AlertDialog 95.2 kB (+315 B) · 13.7 kB CSS (+457 B) — — · — · —
MultiSelector 86.5 kB (+343 B) · 16.2 kB CSS (+414 B) — — · — · —
richtext/RichTextEditor 288.9 kB (+534 B) · 2.6 kB CSS (0) — — · — · —
lab/ChatReactionBar 75.0 kB (+470 B) · 1.1 kB CSS (0) — — · — · —
lab/DiffViewer 77.8 kB (+464 B) · 2.1 kB CSS (0) — — · — · —
lab/ChatEmojiPicker 74.5 kB (+453 B) · 773 B CSS (0) — — · — · —
Timestamp 22.9 kB (+5 B) · 9.5 kB CSS (+446 B) — — · — · —
lab/EmojiPicker 77.4 kB (+439 B) · 751 B CSS (0) — — · — · —
richtext/RichTextView 269.2 kB (+412 B) · 2.3 kB CSS (0) — — · — · —
lab/Schedule 98.3 kB (+392 B) · 3.9 kB CSS (0) — — · — · —
lab/TourStep 66.7 kB (+331 B) · 590 B CSS (0) — — · — · —
lab/ListInput 90.8 kB (+320 B) · 1.6 kB CSS (0) — — · — · —
lab/CommentComposer 115.1 kB (+319 B) · 1.9 kB CSS (0) — — · — · —
DropdownMenu 85.5 kB (+46 B) · 16.6 kB CSS (+16 B) — — · — · —
MoreMenu 85.7 kB (+41 B) · 16.6 kB CSS (+16 B) — — · — · —
richtext/RichTextEditorToolbar 239.2 kB (+42 B) · 454 B CSS (0) — — · — · —
Table 98.2 kB (+19 B) · 17.2 kB CSS (+15 B) — — · — · —
DropdownMenuCheckboxItem 21.1 kB (+1 B) · 6.4 kB CSS (+24 B) — — · — · —
DropdownMenuItem 20.4 kB (0) · 6.0 kB CSS (+24 B) — — · — · —
Item · Storybook 15.9 kB (0) · 5.3 kB CSS (+24 B) 1,697 (0) ✓ · ✓ · —
RadioListItem 61.2 kB (+1 B) · 9.7 kB CSS (+23 B) — — · — · —
SelectorOption 19.3 kB (0) · 5.8 kB CSS (+24 B) — — · — · —
DropdownMenuRadioItem 21.2 kB (−1 B) · 6.4 kB CSS (+24 B) — — · — · —
TreeList 41.4 kB (−1 B) · 5.4 kB CSS (+24 B) — — · — · —
ContextMenuItem 26.5 kB (−5 B) · 6.1 kB CSS (+26 B) — — · — · —
ListItem 63.5 kB (0) · 10.9 kB CSS (+15 B) — — · — · —
CheckboxListItem 64.5 kB (−1 B) · 10.9 kB CSS (+15 B) — — · — · —
DropdownMenuSubMenu 64.4 kB (0) · 9.4 kB CSS (+14 B) — — · — · —
Markdown 160.1 kB (−5 B) · 19.5 kB CSS (+16 B) — — · — · —
lab/TransferList 85.2 kB (+2 B) · 1.7 kB CSS (0) — — · — · —
ContextMenu 88.8 kB (−35 B) · 16.5 kB CSS (+16 B) — — · — · —
TableHeaderCell 89.6 kB (−41 B) · 16.7 kB CSS (+17 B) — — · — · —
TableCell 90.0 kB (−55 B) · 16.9 kB CSS (+17 B) — — · — · —
lab/CommentThread 274.7 kB (−54 B) · 2.4 kB CSS (0) — — · — · —
BreadcrumbItem 75.6 kB (−96 B) · 11.5 kB CSS (+13 B) — — · — · —
lab/Comments 280.5 kB (−86 B) · 2.5 kB CSS (0) — — · — · —
Pagination 98.5 kB (−116 B) · 16.9 kB CSS (+15 B) — — · — · —
Selector 88.5 kB (−118 B) · 16.5 kB CSS (+17 B) — — · — · —
lab/TransferListSelector 92.2 kB (−103 B) · 1.9 kB CSS (0) — — · — · —
PowerSearch 263.3 kB (−149 B) · 22.9 kB CSS (+36 B) — — · — · —

Package size: @astryxdesign/core 6.64 MB packed (+672 B); no new dependencies.

API changes: none in this pull request

Committed API report behind this build: cli 19 rows, core 19 rows; run pnpm api:report.

Touched components checked; add ci:run-visual or ci:run-rtl to run the full suites.


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.

Requesting changes. The compositor release works as described: in Chromium phone emulation the button keeps fading through a busy main thread instead of holding and snapping off, and the FR15 spec change has an engineering owner's approval at this head. Three things need fixing before approval:

  • Nest willChange under @media (pointer: coarse) in controlPressLayerStyles.control (privateAttributes/press.stylex.ts:304), because a pen or a finger on a fine-pointer device now gets will-change: transform for the whole press, against spec:AST-017 FR59 and the changeset's "nothing changes".
  • Build Button's layer from the shared row press-layer styles (rowPressLayerStyles.cell and cellOnImage) instead of copying them into control, keeping only Button's own coarse-guarded willChange, so a fix to one layer cannot miss the other.
  • Reword FR15's new sentence (docs/specs/components/Button/Button.spec.md:134), because a caller's ::before is not replaced during a touch press: its declarations win where they overlap, so the press fill disappears and the decoration moves, and the reworded record needs a fresh /approve-spec at the new head.

Non-blocking: the fine-pointer mouse test's expect(state.press).toBeNull() pins a gap Button's record already lists, so its comment should say so.

[Automated review]

// for it and drops that layer at its end, which repaints the button. A
// layer kept from the touch to the end of the release keeps the release
// free of Paint.
willChange: {default: null, [PRESSED_ANY]: 'transform'},

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.

This is the only control property outside @media (pointer: coarse). On a fine-primary device the controller still writes the press state for a pen or a finger, so the Button gets will-change: transform for the whole press (auto on the base), though the changeset says nothing changes for those pointers. Suggest willChange: {default: null, [COARSE]: {default: null, [PRESSED_ANY]: 'transform'}}, and have keepsPressOutsideCoarse check will-change too.

* rest, and with any other pointer, nothing here applies: no layer, no
* `isolation`, and the variant's own paint and release, as before.
*/
control: {

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.

control repeats rowPressLayerStyles.cell and cellOnImage property for property (and controlRelease repeats cellRelease). Composing Button from those styles, with only a coarse-guarded willChange here, keeps one press layer to fix.

| FR12 | With `tooltip`, the tooltip attaches to the Button element itself (no wrapper element), opens above it, and its content is added to `aria-describedby` after any caller value, unless its trimmed text equals the Button's accessible name as its props decide it (the derived or caller `aria-label`, or `label` when `icon` and `endContent` render nothing or a decorative Icon), as Avatar AR5 does, so a tooltip that repeats the name is not read twice. When the name comes from elsewhere (`aria-labelledby`, or other content in `icon` or `endContent`), the tooltip still describes the Button. IconButton inherits this. | Current source; real-browser accessibility test |
| FR13 | A standalone Button paints the shadow token for its `elevation`. Inside a ButtonGroup it paints no shadow and reflects `data-elevation="none"`, whatever `elevation` says. | `family:buttons` FR8–FR10; current source and tests |
| FR14 | The root carries `astryx-button` and reflects the effective `data-variant`, `data-size`, and `data-elevation`. | `family:buttons` FR10; `architecture:component-theming-surface`; tests |
| FR15 | Hover paints the shared interaction overlay on hover-capable pointers, and a press paints the shared pressed overlay through the press controller: at once under a mouse or a pen (`spec:AST-094` FR11's fine-pointer profile) and on FR11's control profile under a finger, fading out on release on the theme's exit motion tokens (`--duration-exit`, `--ease-exit`; `spec:AST-094` FR5). Under a coarse pointer, Button paints its press release on its own `::before` layer, so a caller's `::before` on a Button is replaced there. Without a reduced-motion preference, a standalone Button also scales to 0.98 on a mouse press, or while the touch press reads on; under reduced motion it MUST NOT scale (`design:reduced-motion` DR1). All of this paint follows the element's exposed disabled state: a Button that is natively disabled or exposes `aria-disabled="true"` (busy-only, disabled with a tooltip, or a caller's own `aria-disabled`) shows no overlay and no press scale, even when it stays operable. Inside a ButtonGroup the press scale does not apply. Button's hover and press transitions are fast, and instant under reduced motion. Implementation gap: the 0.98 press scale also applies under reduced motion; only its transition becomes instant. | Current source and tests; `spec:AST-094` FR11 and DEC-21 for the mouse and pen press |

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.

"a caller's ::before on a Button is replaced there" is not what ships: the caller's ::before declarations win where they overlap (ORD5, INV6), so during a touch press the decoration keeps its size, moves to the start corner, and the press fill disappears. The changeset and doc entry describe a merge; this sentence should too, and then needs re-approval at the new head.

@cixzhang
cixzhang force-pushed the fix/control-press-release-compositor branch from 75408a9 to 9c24db4 Compare November 4, 2026 23:30

@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 pending CI: the heavy suites (test, build, docsite-test and the interaction legs) are deferred on this head and run before merge.

Under a coarse primary pointer, Button's touch release now fades on a compositor layer and keeps fading while script runs once the release is on screen; a fine pointer keeps the press it had, and FR15's new ::before sentence has an engineering owner's approval for this head.

Optional polish:

  • The changeset's "It keeps fading while the page's script is busy" holds once the release is on screen; script in the tap's own click handler starts before the release's first frame and still holds the press until it ends, so "Once the release is on screen, it keeps fading while the page's script is busy" would be exact.
  • Callers who remove the press paint with an xstyle backgroundImage override, such as TransferList's header actions, now see the fill during a touch press; one sentence in the changeset and the doc entry would tell them.

[Automated review]

'@astryxdesign/core': patch
---

[fix] Under a coarse primary pointer (a touch screen as the main input), a button's touch press release now runs on the compositor. It keeps fading while the page's script is busy, instead of freezing at full strength and snapping off, and it paints nothing per frame. The release keeps the theme's exit motion timing. With any other pointer, a finger on a touch screen beside a mouse included, nothing changes. Under a coarse primary pointer, while a press is on or fading, Button paints it on its own `::before` and sets `isolation: isolate`. At rest it adds neither, so a `::before` you style, through `xstyle` or a `className` rule, merges into that layer only during a press. Style a child element to keep it unchanged.

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.

Non-blocking: "It keeps fading while the page's script is busy" holds once the release is on screen. Script in the tap's own click handler runs before the release's first frame, so the press still holds until it ends, as on main. "Once the release is on screen, it keeps fading while the page's script is busy" would be exact. A sentence on xstyle backgroundImage overrides, which now get the fill during a touch press, would also help callers.

| FR12 | With `tooltip`, the tooltip attaches to the Button element itself (no wrapper element), opens above it, and its content is added to `aria-describedby` after any caller value, unless its trimmed text equals the Button's accessible name as its props decide it (the derived or caller `aria-label`, or `label` when `icon` and `endContent` render nothing or a decorative Icon), as Avatar AR5 does, so a tooltip that repeats the name is not read twice. When the name comes from elsewhere (`aria-labelledby`, or other content in `icon` or `endContent`), the tooltip still describes the Button. IconButton inherits this. | Current source; real-browser accessibility test |
| FR13 | A standalone Button paints the shadow token for its `elevation`. Inside a ButtonGroup it paints no shadow and reflects `data-elevation="none"`, whatever `elevation` says. | `family:buttons` FR8–FR10; current source and tests |
| FR14 | The root carries `astryx-button` and reflects the effective `data-variant`, `data-size`, and `data-elevation`. | `family:buttons` FR10; `architecture:component-theming-surface`; tests |
| FR15 | Hover paints the shared interaction overlay on hover-capable pointers, and a press paints the shared pressed overlay through the press controller: at once under a mouse or a pen (`spec:AST-094` FR11's fine-pointer profile) and on FR11's control profile under a finger, fading out on release on the theme's exit motion tokens (`--duration-exit`, `--ease-exit`; `spec:AST-094` FR5). Under a coarse pointer, while a press is on or fading, Button paints the press on its own `::before`; a caller's `::before` styles apply on top of that layer and win where they overlap, so a decoration that must stay through a touch press belongs on a child element. Without a reduced-motion preference, a standalone Button also scales to 0.98 on a mouse press, or while the touch press reads on; under reduced motion it MUST NOT scale (`design:reduced-motion` DR1). All of this paint follows the element's exposed disabled state: a Button that is natively disabled or exposes `aria-disabled="true"` (busy-only, disabled with a tooltip, or a caller's own `aria-disabled`) shows no overlay and no press scale, even when it stays operable. Inside a ButtonGroup the press scale does not apply. Button's hover and press transitions are fast, and instant under reduced motion. Implementation gap: the 0.98 press scale also applies under reduced motion; only its transition becomes instant. | Current source and tests; `spec:AST-094` FR11 and DEC-21 for the mouse and pen press |

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.

Non-blocking: "Under a coarse pointer" reads as any finger; the code, changeset and doc entry mean a coarse primary pointer (spec:AST-094 FR13), and a finger on a fine-primary device gets no layer.

/(^|[{;\s])content:/.test(rule.slice(rule.indexOf('{'))),
)) &&
!layer.some(rule => /animation-(name|duration):/.test(rule)) &&
!fine.some(rule => /isolation:\s*isolate/.test(rule)) &&

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.

Non-blocking: this guard does not check will-change, so moving control's willChange outside the coarse query would still pass. !fine.some(rule => /will-change:/.test(rule)) covers it. The file header (lines 7-10, under the SYNC: note) also still lists only the old exports.

@cixzhang
cixzhang marked this pull request as draft November 5, 2026 20:25
@cixzhang
cixzhang marked this pull request as ready for review November 5, 2026 20:25
Button now imports the private press module, so its swizzle carries
`../privateAttributes/press.stylex.ts` and `../motion/reducedMotion.stylex.ts`
beside the component folder (spec:AST-110 FR4), and the last file in copy
order lives outside `out/Button/`. The tests now make the component folder
and the last file's folder before their setup writes, and look for the
failed path as the CLI reports it (relative to the project). The CLI
behaviour is unchanged: a failed write still restores what it replaced and
removes what it created.
@cixzhang

cixzhang commented Nov 5, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec d54127d

@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 pending CI: typecheck, lint and the smoke test pass on this head, and the heavy suites (build, test, docsite-test and the interaction legs) are deferred and run before merge.

Under a coarse primary pointer, Button's touch release now fades on a compositor layer and keeps fading while script runs once the release is on screen; a fine pointer keeps the press it had, and FR15's new ::before sentence has an engineering owner's approval for this head. The latest commit updates the two swizzle rollback tests for the owner module Button now carries, and they pass.

Optional polish:

  • The changeset's "It keeps fading while the page's script is busy" holds once the release is on screen; script in the tap's own click handler starts before the release's first frame and still holds the press until it ends, so "Once the release is on screen, it keeps fading while the page's script is busy" would be exact.
  • Callers who remove the press paint with an xstyle backgroundImage override, such as TransferList's header actions, now see the fill during a touch press; one sentence in the changeset and the doc entry would tell them.

[Automated review]

@cixzhang
cixzhang marked this pull request as draft November 5, 2026 22:36
@cixzhang
cixzhang marked this pull request as ready for review November 5, 2026 22:37
@cixzhang

cixzhang commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 4accc64

@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 pending CI: typecheck, lint and the smoke test pass on this head, and the heavy suites (build, test, docsite-test and the interaction legs) are deferred and run before merge.

Under a coarse primary pointer, Button's touch release now fades on a compositor layer and keeps fading while script runs once the release is on screen; a fine pointer keeps the press it had, and FR15's new ::before sentence has an engineering owner's approval for this head. The merge of main leaves this pull request's own patch unchanged, and ButtonGroup members that follow a finger's slide paint their press from the same layer.

Optional polish:

  • The changeset's "It keeps fading while the page's script is busy" holds once the release is on screen; script in the tap's own click handler starts before the release's first frame and still holds the press until it ends, so "Once the release is on screen, it keeps fading while the page's script is busy" would be exact.
  • Callers who remove the press paint with an xstyle backgroundImage override, such as TransferList's header actions, now see the fill during a touch press; one sentence in the changeset and the doc entry would tell them.

[Automated review]

@cixzhang
cixzhang marked this pull request as draft November 6, 2026 00:50
@cixzhang
cixzhang marked this pull request as ready for review November 6, 2026 00:50
…branch's coarse-pointer sentence; main's reduced-motion gap closed)
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Nov 6, 2026
@cixzhang

cixzhang commented Nov 6, 2026

Copy link
Copy Markdown
Contributor Author

/approve-spec 216d477

@github-actions github-actions Bot removed the needs:spec-owner-review Current knowledge records await owner approval label Nov 6, 2026

@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 pending CI: typecheck, lint and the smoke test pass on this head, and the heavy suites (build, test, docsite-test and the interaction legs) are deferred and run before merge.

Under a coarse primary pointer, Button's touch press release is now an opacity fade on the compositor, on the theme's exit tokens, so a release already on screen keeps fading while the page runs script; a fine pointer keeps the press it had, and FR15's new sentence covers what a caller's ::before does during a touch press. A few optional follow-ups, none blocking:

  • The changeset's "It keeps fading while the page's script is busy" holds once the release is on screen; script in the tap's own click handler runs before its first frame, so "Once the release is on screen, it keeps fading …" would be exact.
  • A Button whose xstyle sets backgroundImage: 'none' to drop the press (the table-filter template's transfer header actions) now shows the pressed fill during a touch press; one sentence in the changeset and the doc entry would tell such callers.
  • FR15's "Under a coarse pointer" means a coarse primary pointer, as the changeset and doc entry say.

[Automated review]

@cixzhang cixzhang added the ci:run-a11y Run the accessibility suite on this PR; write access, next push (AST-030 FR12) label Nov 6, 2026
@cixzhang
cixzhang marked this pull request as draft November 6, 2026 02:31
@cixzhang
cixzhang marked this pull request as ready for review November 6, 2026 02:32
@cixzhang
cixzhang merged commit e8ecde4 into main Nov 6, 2026
114 of 118 checks passed
@github-actions
github-actions Bot deleted the fix/control-press-release-compositor branch November 6, 2026 06:04

This branch was successfully deployed

1 active deployment
Preview — 216d4775 Deployed Nov 6, 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 A maintainer lets this outside contributor's pull request run CI (AST-030 FR17) 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. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants