Repository navigation
fix(core): a button's touch press release runs on the compositor - #9783
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
There was a problem hiding this comment.
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
willChangeunder@media (pointer: coarse)incontrolPressLayerStyles.control(privateAttributes/press.stylex.ts:302), because a pen or finger press on a fine-pointer device now getswill-change: transform, againstspec:AST-017FR59 and the changeset's "nothing changes". - Drop
expect(state.press).toBeNull()from the fine-pointer mouse test (ButtonPressRelease.interaction.browser.spec.ts:376), becausecomponent:ButtonFR15 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.cellandcellOnImage, keeping only Button's own coarse-guardedwillChange(and later its clock) incontrol.
[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'}, |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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: { |
There was a problem hiding this comment.
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.
0f28e7c to
6e6dbb6
Compare
There was a problem hiding this comment.
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
willChangeunder@media (pointer: coarse)incontrolPressLayerStyles.control(privateAttributes/press.stylex.ts:306), because a pen or finger press on a fine-pointer device now getswill-change: transform, againstspec:AST-017FR59 and the changeset's "nothing changes". - Drop
expect(state.press).toBeNull()from the fine-pointer mouse test (ButtonPressRelease.interaction.browser.spec.ts:376), becausespec:AST-094FR11 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.cellandcellOnImage) instead of copying them, keeping only Button's own coarse-guardedwillChange(and later its clock) incontrol.
[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'}, |
There was a problem hiding this comment.
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(); |
There was a problem hiding this comment.
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: { |
There was a problem hiding this comment.
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.
1b6a265 to
3b74202
Compare
6e6dbb6 to
e483f29
Compare
|
/approve-spec e483f29 |
e483f29 to
75408a9
Compare
|
/approve-spec 75408a9 |
PR Analysis Report🔎 Preview ·
|
| 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
There was a problem hiding this comment.
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
willChangeunder@media (pointer: coarse)incontrolPressLayerStyles.control(privateAttributes/press.stylex.ts:304), because a pen or a finger on a fine-pointer device now getswill-change: transformfor the whole press, againstspec:AST-017FR59 and the changeset's "nothing changes". - Build Button's layer from the shared row press-layer styles (
rowPressLayerStyles.cellandcellOnImage) instead of copying them intocontrol, keeping only Button's own coarse-guardedwillChange, 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::beforeis 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-specat 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'}, |
There was a problem hiding this comment.
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: { |
There was a problem hiding this comment.
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 | |
There was a problem hiding this comment.
"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.
75408a9 to
9c24db4
Compare
There was a problem hiding this comment.
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
xstylebackgroundImageoverride, 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. |
There was a problem hiding this comment.
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 | |
There was a problem hiding this comment.
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)) && |
There was a problem hiding this comment.
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.
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.
|
/approve-spec d54127d |
There was a problem hiding this comment.
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
xstylebackgroundImageoverride, 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]
|
/approve-spec 4accc64 |
There was a problem hiding this comment.
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
xstylebackgroundImageoverride, 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]
…branch's coarse-pointer sentence; main's reduced-motion gap closed)
|
/approve-spec 216d477 |
There was a problem hiding this comment.
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
xstylesetsbackgroundImage: '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]
Supersedes #8118 by @vjeux, rebuilt on
mainafter 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.
main.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
mainafter #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 namesmain's newrowPressPaintStylesbeside this change'scontrolPressLayerStyles, andcontrolPressLayerStylessits 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, asmain'sListRowPresscase records. The "keeps the layer until its strength reaches 0" check runs in both engines.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:changesetsall pass.Problem and solution fit
Under a coarse primary pointer, Button composes the list row's compositor press layer (
rowPressLayerStyles.cellandcellOnImageinprivateAttributes/press.stylex.ts), so one set of styles serves both, and adds only awill-change: transform(controlPressLayerStyles.control) so its press-scale transition does not repaint at its end. The layer,isolationandwill-changeexist 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)withvar(--ease-exit), andmin(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
mainand Specs & Decisions' rulings changed what this pull request carries:motion/uikit/button.ts), its mirror, the mouse and key input marker that split 200 from 250 ms, and the 250 ms arms are all dropped.::afterlayer (controlOver) is not here.motion/uikit/button.ts,astryx component buttonhas nothing new to resolve to.main's capped exit clock.privateAttributes/press.stylex.tsbeside the row layer (architecture:public-component-apiINV23).Expected behavior and authority
component:ButtonFR15 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::beforestyles 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::beforeon touch.spec:AST-094FR5 requires the compositor release and the exit motion tokens.design:user-statesDR1 and DR5. A fine pointer is unchanged (spec:AST-017FR59).Verification
isolationat rest. Both fail onmainand pass here.keepsPressOutsideCoarse), and an Item row keeps its layer to a press.check:changesets.ButtonPressRelease,ButtonPressTiming,ButtonPressandListRowPresspass 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-exitand--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, theButtonPressReleaselayer cases fail, because Button has no::beforelayer there.Scope
Writing rubric results