Repository navigation
fix(Button): under a finger, a Button's target grows toward 44 px through the shared touch band - #10216
Conversation
…ough the shared touch band A standalone, enabled Button takes useTouchHitArea and touchHitAreaStyles.layer, so its target grows as far as its neighbors leave room, and its box stays as it is. A grouped Button keeps its group's band; a disabled or busy Button gets none. InputClearButton drops its fixed 24 px ::after and its two private vars, and uses the Button band.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
|
/approve-spec fc8a8fe |
PR Analysis Report🔎 Preview ·
|
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| AppShell | 🔴 85.1 kB (+3.9 kB) · 13.0 kB CSS (+242 B) | — | — · — · — |
| ChatLayoutScrollButton | 🔴 56.1 kB (+3.9 kB) · 9.7 kB CSS (+239 B) | — | — · — · — |
| Button · Storybook | 🔴 55.5 kB (+3.9 kB) · 9.5 kB CSS (+238 B) | 678 (+16) | — · — · — |
95 more components
| Component | Size | LoC | Visual · A11y · RTL |
|---|---|---|---|
| ChatSendButton | 🔴 56.0 kB (+3.9 kB) · 9.5 kB CSS (+239 B) | — | — · — · — |
| Banner | 🔴 57.5 kB (+3.9 kB) · 10.1 kB CSS (+239 B) | — | — · — · — |
| SideNavCollapseButton | 🔴 56.4 kB (+3.9 kB) · 9.6 kB CSS (+238 B) | — | — · — · — |
| IconButton | 🔴 55.6 kB (+3.9 kB) · 9.5 kB CSS (+238 B) | — | — · — · — |
| MobileNavToggle | 🔴 55.9 kB (+3.9 kB) · 9.5 kB CSS (+238 B) | — | — · — · — |
| ChatDictationButton | 🔴 56.1 kB (+3.9 kB) · 9.6 kB CSS (+238 B) | — | — · — · — |
| ToggleButton | 🔴 56.4 kB (+3.9 kB) · 9.6 kB CSS (+238 B) | — | — · — · — |
| ChatLayout | 🔴 58.8 kB (+3.8 kB) · 10.1 kB CSS (+238 B) | — | — · — · — |
| Thumbnail | 🔴 59.9 kB (+3.9 kB) · 11.1 kB CSS (+227 B) | — | — · — · — |
| TableSelectionToolbar | 🔴 65.0 kB (+3.8 kB) · 12.6 kB CSS (+240 B) | — | — · — · — |
| Stepper | 🔴 57.2 kB (+3.8 kB) · 9.7 kB CSS (+239 B) | — | — · — · — |
| Calendar | 🔴 66.3 kB (+3.8 kB) · 10.1 kB CSS (+236 B) | — | — · — · — |
| DialogHeader | 🔴 58.3 kB (+3.8 kB) · 11.1 kB CSS (+238 B) | — | — · — · — |
| DrawerHeader | 🔴 58.5 kB (+3.8 kB) · 12.5 kB CSS (+240 B) | — | — · — · — |
| Popover | 🔴 64.8 kB (+3.8 kB) · 13.6 kB CSS (+219 B) | — | — · — · — |
| CodeBlock | 🔴 70.0 kB (+3.8 kB) · 10.8 kB CSS (+224 B) | — | — · — · — |
| SideNavItem | 🔴 65.5 kB (+3.8 kB) · 10.7 kB CSS (+236 B) | — | — · — · — |
| Toast | 🔴 93.0 kB (+3.8 kB) · 9.8 kB CSS (+236 B) | — | — · — · — |
| Carousel | 🔴 63.4 kB (+3.8 kB) · 10.5 kB CSS (+221 B) | — | — · — · — |
| ChatComposer | 🔴 72.0 kB (+3.7 kB) · 11.4 kB CSS (+231 B) | — | — · — · — |
| SideNavHeading | 🔴 70.6 kB (+3.7 kB) · 10.8 kB CSS (+234 B) | — | — · — · — |
| BaseTypeahead | 🔴 65.8 kB (+3.7 kB) · 10.5 kB CSS (+231 B) | — | — · — · — |
| TopNavHeading | 🔴 70.0 kB (+3.7 kB) · 10.6 kB CSS (+235 B) | — | — · — · — |
| ChatComposerInput | 🔴 70.0 kB (+3.7 kB) · 10.8 kB CSS (+232 B) | — | — · — · — |
| ChatComposerTokenElement | 🔴 70.0 kB (+3.7 kB) · 10.8 kB CSS (+232 B) | — | — · — · — |
| TopNavMegaMenu | 🔴 64.8 kB (+3.7 kB) · 11.4 kB CSS (+228 B) | — | — · — · — |
| TopNavMenu | 🔴 69.6 kB (+3.7 kB) · 10.8 kB CSS (+236 B) | — | — · — · — |
| BreadcrumbItem | 🔴 79.5 kB (+3.6 kB) · 11.7 kB CSS (+229 B) | — | — · — · — |
| TabMenu | 🔴 66.8 kB (+3.6 kB) · 10.7 kB CSS (+234 B) | — | — · — · — |
| Lightbox | 🔴 106.6 kB (+3.6 kB) · 10.0 kB CSS (+237 B) | — | — · — · — |
| lab/DiffViewer | 🔴 81.9 kB (+3.8 kB) · 2.1 kB CSS (0) | — | — · — · — |
| AlertDialog | 🔴 99.3 kB (+3.6 kB) · 13.9 kB CSS (+237 B) | — | — · — · — |
| SideNav | 🔴 84.6 kB (+3.6 kB) · 10.9 kB CSS (+235 B) | — | — · — · — |
| lab/TourStep | 🔴 70.9 kB (+3.8 kB) · 590 B CSS (0) | — | — · — · — |
| MobileNav | 🔴 65.1 kB (+3.5 kB) · 10.2 kB CSS (+242 B) | — | — · — · — |
| TopNav | 🔴 66.8 kB (+3.5 kB) · 10.5 kB CSS (+237 B) | — | — · — · — |
| DropdownMenu | 🔴 89.7 kB (+3.7 kB) · 16.7 kB CSS (0) | — | — · — · — |
| MoreMenu | 🔴 90.0 kB (+3.7 kB) · 16.7 kB CSS (0) | — | — · — · — |
| richtext/RichTextEditorToolbar | 244.4 kB (+442 B) · 454 B CSS (0) | — | — · — · — |
| lab/Comments | 302.1 kB (+366 B) · 2.5 kB CSS (0) | — | — · — · — |
| Timestamp | 23.2 kB (+47 B) · 9.8 kB CSS (+239 B) | — | — · — · — |
| lab/CommentThread | 296.4 kB (+275 B) · 2.4 kB CSS (0) | — | — · — · — |
| lab/EmojiPicker | 81.4 kB (+174 B) · 751 B CSS (0) | — | — · — · — |
| Markdown | 162.3 kB (+146 B) · 19.5 kB CSS (0) | — | — · — · — |
| lab/CommentComposer | 120.2 kB (+146 B) · 1.9 kB CSS (0) | — | — · — · — |
| richtext/RichTextView | 271.2 kB (+131 B) · 2.3 kB CSS (0) | — | — · — · — |
| FileInput | 64.4 kB (+225 B) · 10.5 kB CSS (−101 B) | — | — · — · — |
| MultiSelector | 88.9 kB (+188 B) · 16.2 kB CSS (−94 B) | — | — · — · — |
| DateRangeInput | 85.8 kB (+197 B) · 12.0 kB CSS (−104 B) | — | — · — · — |
| lab/Schedule | 99.3 kB (+93 B) · 3.9 kB CSS (0) | — | — · — · — |
| DateTimeInput | 195.3 kB (+183 B) · 18.0 kB CSS (−96 B) | — | — · — · — |
| ComplexSelector | 65.9 kB (+86 B) · 11.3 kB CSS (0) | — | — · — · — |
| NumberInput | 67.0 kB (+186 B) · 11.0 kB CSS (−101 B) | — | — · — · — |
| TextInput | 62.9 kB (+179 B) · 10.7 kB CSS (−103 B) | — | — · — · — |
| lab/ListInput | 95.5 kB (+67 B) · 1.6 kB CSS (0) | — | — · — · — |
| Selector | 93.3 kB (+169 B) · 16.8 kB CSS (−104 B) | — | — · — · — |
| TimeInput | 149.8 kB (+179 B) · 15.3 kB CSS (−120 B) | — | — · — · — |
| DateInput | 172.9 kB (+143 B) · 16.3 kB CSS (−105 B) | — | — · — · — |
| richtext/RichTextEditor | 290.9 kB (+13 B) · 2.6 kB CSS (0) | — | — · — · — |
| TextArea | 57.9 kB (+9 B) · 9.2 kB CSS (0) | — | — · — · — |
| ButtonGroup · Storybook | 40.1 kB (+7 B) · 3.7 kB CSS (0) | 146 (0) | — · — · — |
| Field | 50.5 kB (+6 B) · 7.2 kB CSS (0) | — | — · — · — |
| InputGroup | 52.1 kB (+6 B) · 7.8 kB CSS (0) | — | — · — · — |
| RadioListItem | 62.7 kB (+6 B) · 9.8 kB CSS (0) | — | — · — · — |
| SegmentedControlItem | 16.2 kB (+6 B) · 4.3 kB CSS (0) | — | — · — · — |
| InfoTip · Storybook | 43.3 kB (+5 B) · 5.3 kB CSS (0) | 148 (0) | — · — · — |
| RadioList | 51.8 kB (+4 B) · 7.2 kB CSS (0) | — | — · — · — |
| lab/PageControl | 71.7 kB (+4 B) · 709 B CSS (0) | — | — · — · — |
| lab/SelectableCardGroup | 59.7 kB (+4 B) · 162 B CSS (0) | — | — · — · — |
| FieldLabel | 47.1 kB (+3 B) · 5.6 kB CSS (0) | — | — · — · — |
| Slider | 101.8 kB (+3 B) · 8.7 kB CSS (0) | — | — · — · — |
| Switch | 96.3 kB (+2 B) · 9.8 kB CSS (0) | — | — · — · — |
| CheckboxList | 54.3 kB (+1 B) · 7.9 kB CSS (0) | — | — · — · — |
| CheckboxIndicator | 2.7 kB (0) · 813 B CSS (0) | — | — · — · — |
| CheckIndicator | 8.0 kB (0) · 681 B CSS (0) | — | — · — · — |
| List | 5.4 kB (0) · 469 B CSS (0) | — | — · — · — |
| RadioIndicator | 2.5 kB (0) · 725 B CSS (0) | — | — · — · — |
| SegmentedControl | 89.5 kB (0) · 6.8 kB CSS (0) | — | — · — · — |
| lab/NavigationScreen | 78.4 kB (0) · 1.5 kB CSS (0) | — | — · — · — |
| lab/NavigationStack | 78.4 kB (0) · 1.5 kB CSS (0) | — | — · — · — |
| CheckboxInput · Storybook | 59.8 kB (−1 B) · 9.1 kB CSS (0) | 441 (0) | — · — · — |
| CheckboxListItem | 65.9 kB (−1 B) · 10.9 kB CSS (0) | — | — · — · — |
| ListItem | 64.9 kB (−1 B) · 10.9 kB CSS (0) | — | — · — · — |
| Pagination | 103.3 kB (+70 B) · 17.2 kB CSS (−113 B) | — | — · — · — |
| lab/TransferListSelector | 96.9 kB (−55 B) · 1.9 kB CSS (0) | — | — · — · — |
| lab/TransferList | 90.0 kB (−63 B) · 1.7 kB CSS (0) | — | — · — · — |
| lab/ChatEmojiPicker | 78.5 kB (−69 B) · 773 B CSS (0) | — | — · — · — |
| lab/ChatReactionBar | 79.7 kB (−97 B) · 1.1 kB CSS (0) | — | — · — · — |
| TableCell | 91.6 kB (−109 B) · 17.0 kB CSS (0) | — | — · — · — |
| ContextMenu | 90.4 kB (−139 B) · 16.6 kB CSS (0) | — | — · — · — |
| PowerSearch | 270.9 kB (−72 B) · 23.1 kB CSS (−80 B) | — | — · — · — |
| TableHeaderCell | 91.2 kB (−154 B) · 16.8 kB CSS (0) | — | — · — · — |
| Tokenizer | 84.7 kB (−52 B) · 18.0 kB CSS (−107 B) | — | — · — · — |
| Table | 99.7 kB (−188 B) · 17.3 kB CSS (0) | — | — · — · — |
| Typeahead | 74.2 kB (−177 B) · 12.0 kB CSS (−99 B) | — | — · — · — |
Package size: @astryxdesign/core 6.75 MB packed (+1.9 kB); no new dependencies.
API changes: none in this pull request
Committed API report behind this build: cli 19 rows, core 24 rows; run pnpm api:report.
Wide change (shared styles: packages/core/src/internal/touchHitArea.stylex.ts, packages/core/src/utils/touchHitArea.stylex.ts): add ci:run-visual, ci:run-a11y or ci:run-rtl to run them.
Generated by PR Enrichment workflow | View full report
…p and never takes a neighbor's tap A Touch targets story puts a dense toolbar above a field with a clear button; the browser spec measures each band against its neighbors and taps the gap, the band and the field's text.
|
/approve-spec a83f5f8 |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet. The repository's CI runs nothing on a draft, so marking this ready is what starts it, including the touch interaction job the description names as its evidence.
Under a finger, standalone and enabled Buttons and IconButtons now take a band that grows toward 44 px and stops halfway to each neighbor, the input clear button uses the same band instead of its fixed 24 px overlay, and nothing changes under a mouse. The new browser spec and unit tests pass on this head in Chromium.
- Non-blocking: the new comment above
hasHitAreainButton.tsxrestates whatuseTouchHitAreadoes; a shorter version that keeps only the reasons is suggested inline.
[Automated review]
…resolves it; split the clear-button browser proof Swizzle rewrites every .stylex import to its package subpath, so utils/touchHitArea.stylex joins the deliberate STATIC_EXPORTS entries. The clear button's text-tap and band-tap checks run on fresh pages, so one tap cannot change how WebKit reads the next.
internal/touchHitArea.stylex is listed with the other internal entries, so swizzle resolves it and it stays outside the public API. This replaces the public subpath. Every importer follows the move, so a swizzled ListItem, CheckboxInput, RadioListItem, InfoTip or SegmentedControl item resolves it too.
|
/approve-spec 717ea6f |
There was a problem hiding this comment.
Changes requested: two small fixes before this can merge.
- The new
./internal/touchHitArea.stylexexport makespackages/core/src/__tests__/publicStyleXNamespaces.test.tsfail ("cover every exported .stylex subpath and style namespace"); import the module, add the subpath tostyleNamespacesBySubpathandmodulesBySubpath, and addtouchHitAreaStylestoPropsOnlyNamespaces. - The changeset's last sentence says swizzling a Button, ListItem, CheckboxInput, RadioListItem, InfoTip or SegmentedControl no longer leaves an unresolved touch-band style import, but a swizzled Button never had that import, and each of those copies still imports
useTouchHitAreafrom@astryxdesign/core/utils, which does not export it; please drop the sentence or narrow it to the style import that now resolves.
The touch band itself looks right: standalone, enabled Buttons and the input clear button get the shared coarse-pointer band, and nothing changes under a mouse. The earlier comment-style suggestion on Button.tsx still applies and is non-blocking.
[Automated review]
|
/approve-spec b0d6684 |
There was a problem hiding this comment.
Requesting changes: one blocking issue with the input clear button in WebKit.
- Miss: In WebKit, taps a few pixels beside the input clear ✕ (2–4 px below, 2–8 px right, 3–5 px above), which clear the field on
main, do nothing on this head, because they now land on the band inside the button andInputClearButton'sonPointerDown(InputClearButton.tsx:96) cancels every touchpointerdown, which in WebKit drops the click; skippreventDefault()for a touchpointerdown(theonMouseDownhandler still keeps focus in the field), then drop the WebKit note incomponent:Fieldand the WebKittest.fixme, whose stated cause, engine touch adjustment, is not what happens.
The earlier press-check issue is fixed: in WebKit, a band tap nearer an offset neighbour is now swallowed instead of pressing the farther Button. Non-blocking: the offset-neighbour browser case's WebKit taps round onto the neighbour's band, so that leg passes without the fix; a whole-pixel point inside the first button's band would cover it.
[Automated review]
WebKit drops the click of a touch whose pointerdown is cancelled, so a tap on the band beside the clear button did nothing. The button cancels pointerdown only for a mouse or pen now; for touch, its mousedown handler still keeps focus in the field. The WebKit fixme and the Field and Button records' gap notes go. The offset-neighbour browser case taps a whole pixel inside Undo's band, so its WebKit leg fails without the press check.
|
/approve-spec 319e3b0 |
There was a problem hiding this comment.
Changes requested: the touch band works as described for Buttons and on the text side of the clear button, but one regression in the clear button needs a fix first.
- Miss: on a clearable
SelectororMultiSelector, a finger tap on the disclosure chevron now clears the value instead of opening the list, in Chromium and WebKit, because the clear button's band reaches 12 px past the ✕ over the chevron with nothing to clamp it; stopping the band at half the gap to the next item in the field, and adding a browser case that taps the chevron, would fix it.
The rest checks out: bands stop at half the gap between buttons, nothing changes under a mouse, and a tap on the clear band clears and keeps focus in the field in both engines. Non-blocking: the header of internal/touchHitArea.stylex.ts still describes the band only as the host's own ::after, and the edited JSDoc line in utils/touchHitArea.ts needs rewrapping.
[Automated review]
…xt part A clearable Selector's chevron sits 8 px past the clear button and is not interactive itself, so no hit-area neighbour stopped the band over it: a finger tap on the chevron cleared the value instead of opening the list. The clear button passes Button a growth that stops each side at half the gap to the field's next part (chevron, status icon, spinner), through an internal ButtonHitAreaContext. A browser case taps a clearable Selector's chevron. The touchHitArea headers name the descendant band.
|
/approve-spec 054f11c |
…:AST-094 FR42) The verification map gains a row for the browser cases: the clear band stops at half the gap to the text and to the field's next part, and a tap on a clearable Selector's chevron opens it.
|
/approve-spec a60af0a |
There was a problem hiding this comment.
Changes requested: the Button band and the clear button's band beside the text work as described in Chromium and WebKit, and the chevron fix works in Chromium, but two things need fixing first.
- In WebKit, a finger tap at the centre of a clearable
Selector's orMultiSelector's chevron still clears the value instead of opening the list (it opens onmain), and the new chevron case inButtonHitArea.interaction.browser.spec.tsfails in WebKit, so the clear button's reach toward the chevron needs to stay short enough for WebKit (main's 2 px holds) or the chevron area needs to take the field's open tap. clearButtonGrowthinInputClearButton.tsxre-implements the half-gap clamp thatclampedHitInsetsinutils/hitArea.tsalready provides, so pass the field's parts to the shared clamp (asuseGroupPressTrackingdoes withgroupGrowth) instead of keeping a second copy.
Unit tests, Core's typecheck and the other browser cases pass. Non-blocking: the last sentence of clearButtonGrowth's JSDoc could be split into two shorter ones.
[Automated review]
… parts In WebKit, a tap moves toward a clickable element near it, and the chevron is not clickable itself, so a band 4 px from the chevron still took a tap on its centre. Toward a part beside it, the band now stops at 2 px, the reach of the old overlay. The half-gap clamp is the shared clampedHitInsets, given the field's parts.
|
/approve-spec 26bd5ed |
There was a problem hiding this comment.
Approved pending CI: CI has not run on this head yet, because a draft runs no CI until it is marked ready for review.
Both earlier blocking findings are fixed: a finger tap on a clearable Selector's chevron now opens the list in WebKit as well as Chromium, and clearButtonGrowth uses the shared clampedHitInsets. The browser spec's touch-band cases pass in both engines, on this head and merged with main.
[Automated review]
User impact
On a phone, a person tapping a small Button, an IconButton or an input's clear (✕) button often misses it, because the target is only as big as the drawn control: 20–32 px. With this change the target grows toward 44 px under a finger, as far as the neighbors leave room, and the drawn box doesn't change. Under a mouse nothing changes.
ButtonGroupkeeps the group's own band (the press-tracking groups already have one), so members don't overlap.What this guarantees
::afterdecoration on a Button stays as it is, under a mouse and under a finger. The band exists only under(pointer: coarse), and no box changes size.What changes
Button.tsx: a standalone, enabled Button callsuseTouchHitArea, and its content wrapper (already rendered,display: contents) carries the band on its::after. That's absolute and coarse-only, so it adds no element and no layout. The button's own::before(the touch press) and::after(a caller'sxstyledecoration) are untouched.useTouchHitAreatakesownsDescendantTouches(defaulttrue) and passes it to the watch. Button turns it off: its band sits on a descendant, and its content never paints past its box, so the press check still swallows a band tap nearer a neighbor.InputClearButton.tsx: the::afteroverlay and its two private vars are removed. They are also removed fromField.doc.mjsand the derived-var registry. The button cancelspointerdownonly for a mouse or pen: WebKit drops the click of a touch whosepointerdownis cancelled. For touch, itsmousedownhandler still keeps focus in the field.Button.hitArea.test.tsx: a standalone and a link Button are watched and take the band; a disabled, busy or grouped Button takes none.InputClearButton.test.tsx: the 24 px overlay tests become one test showing that the clear button takes Button's band, plus one showing that a touchpointerdownis not cancelled whilemousedownstill is.Button.spec.md: an AST-094 FR42 verification row andverified_by. No requirement change, because AST-094 FR42 already governs a control that no record sets a hit area for.utils/tointernal/touchHitArea.stylexand is listed with the other internal entries insync-exports. Swizzle rewrites every.styleximport to a package subpath, so a swizzled Button needs it to resolve. The move also fixes the same unresolved import in a swizzled ListItem, CheckboxInput, RadioListItem, InfoTip or SegmentedControl item. Internal entries stay outside the public API, and every importer follows the move.[fix], which also names the swizzle fix.Browser evidence
ButtonHitArea.interaction.browser.spec.tsruns on the new "Touch targets" Button story (a toolbar with 4 px gaps above a field with a clear button), under a real finger in a phone-sized touch context:The interaction job's run on this head is the evidence. This PR goes ready only after it's green.
Tests
pnpm check:knowledgeandcheck:changesetspass.Sequencing
Button.tsxis also changed by #7906 (a disabled Button stays focusable througharia-disabled), which is in review. The hunks don't overlap: that PR changes the disabled attributes, and this one adds the band's ref and style. This PR waits behind #7906 if both are ready, and merges main before landing. The Button label-wrapper fix for #6939 has no PR yet. Whichever of these lands second merges main and reruns the Button suites.Writing rubric results
spec:AST-094FR42,audit:Button/behavior).