Repository navigation
fix(FieldLabel): a tap on the label's info icon opens its help without activating the control - #9089
Conversation
…ut activating the control On a touch screen, the tap on FieldLabel's info icon (labelTooltip) that opened the help also activated the label's control: it focused the field, raising the keyboard, or toggled the switch or checkbox. The icon's tooltip opens on every tap (touchTrigger="tap"), and a tap by finger or pen stops at the help. A mouse click on the icon keeps native label activation, and hover shows the help. The FieldLabel record gains FR9 and DEC-1 for the tap, and the labelTooltip docs describe hover and tap.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report
Component Size
Sizes are gzip. Import counts the JavaScript the import loads eagerly; CSS counts the package stylesheet rules referenced by the modules it can load from its own package, lazily loaded ones included. Bundle Size SummaryGzip figures measure each package's entry file, not the code an import pulls in.
Accessibility AuditStatus: The accessibility audit did not run on this pull request. It runs after merges to Generated by PR Enrichment workflow | View full report |
There was a problem hiding this comment.
Approval waits on an engineering owner's decision on the new FR9 and DEC-1 in the FieldLabel record. The question is whether a finger or pen tap on the label's info icon may open its help without activating the control, an exception to the record's "activate eligible controls from the complete visible label area". An engineering owner, the author included if they are one, records that decision by commenting /approve-spec <full head SHA> on this pull request. Two fixes are needed either way:
- FR9 says the help opens "on every tap", but a second tap closes it, as the Tooltip's touch rules state; reword FR9 to defer to those rules.
- FR9's verification row counts the text-field case as proof that a tap leaves the field unfocused, but that test passes even without the fix; add a real-browser touch check, or record the focus half as a gap.
[Automated review]
| | FR6 | Accepted data, ARIA, DOM, class, style, event, and `xstyle` inputs compose on the label element without replacing the component-owned target or association. When a description renders, the outer wrapper is layout-only and caller props stay on the inner label element. | `architecture:public-component-api/INV5–INV7` | | ||
| | FR7 | The public ref and label-element props MUST describe the element FieldLabel renders in each mode; which root element and public type group mode uses is OQ1. Implementation gap: group mode renders a `<span>` while the public BaseProps and ref types are fixed to `HTMLLabelElement`. | `architecture:public-component-api/INV8,INV9`; current runtime/types | | ||
| | FR8 | The optional tooltip's explanatory content MUST be reachable by keyboard (WCAG 2.2 SC 2.1.1) and its trigger MUST have an accessible name and role (WCAG 2.2 SC 4.1.2). Implementation gap: it anchors to an anonymous, nonfocusable info icon, so the content is pointer-only. | WCAG 2.2 SC 2.1.1, SC 4.1.2; `spec:AST-020/FR1` | | ||
| | FR9 | A tap on the tooltip's info icon, by finger or pen, opens the tooltip on every tap (`touchTrigger="tap"`) and does not activate the associated control. A mouse click on the icon activates the control like the rest of the label, and hover shows the tooltip. | DEC-1 | |
There was a problem hiding this comment.
A second tap on the icon closes the help: Tooltip's touch rules close a tap-opened tooltip on the next tap, and that is what the component does. "Opens the tooltip on every tap" describes behavior it does not have. Suggest: a finger or pen tap opens or closes the tooltip as Tooltip's touch rules state under touchTrigger="tap", and does not activate the associated control.
| | FR6, ORD2 | `FieldLabel.test.tsx` ref, layout-item, and label-target cases; `themingTargets.test.ts` | Ref; composed target; with a description wrapper | A dropped ref or a lost `field-label` target fails; a rendered class absent from the documented targets fails. Evidence gap: no test asserts caller class, style, `xstyle`, data, and event props on the inner label element with a description wrapper. | `audit:FieldLabel/api` | | ||
| | FR7 | Evidence gap: no type test pins the public ref and props against the rendered group span | — | — | `audit:FieldLabel/api` | | ||
| | FR8, AR5 | `FieldLabelAudit.a11y.chromium.spec.ts` tooltip-anchor count | Tooltip present | The audit records the one anonymous, nonfocusable anchor; it changes when the FR8 gap closes. | `audit:FieldLabel/accessibility` | | ||
| | FR9 | `FieldLabel.test.tsx` finger-tap, pen-tap, and mouse-click info-icon cases | Checkbox; text field | A tap that toggles or focuses the control, or a mouse click that does not toggle it, fails. | `audit:FieldLabel/accessibility` | |
There was a problem hiding this comment.
The text-field case cannot fail: it passes with main's FieldLabel.tsx and with the preventDefault() removed, because jsdom's label activation never focuses a text input. Either add a real-browser touch check that focus stays off the field, or record the focus half of FR9 as an evidence gap here.
|
/approve-spec ca6ffbf |
spec:AST-017 DEC-17 counts a change to documented touch activation as breaking, so the changeset bumps the minor, names the old tap (it also activated the label's control) and how to get it back: an info icon rendered through labelIcon with its own Tooltip, whose tap opens the help and activates the control.
spec:AST-017 FR53 classifies an accessibility behavior fix as a patch [fix], even when it replaces documented interaction: the label's help becomes reachable on touch as its own interaction, the operable path architecture:interaction-modality INV4 asks of every modality, and no caller needs a code change. The changeset names the old and new tap and that target.
|
/approve-spec b08a560 |
There was a problem hiding this comment.
Changes requested: the touch behavior works as described and the FR9/DEC-1 spec decision is approved, but four fixes are needed first. Rewording FR9 changes the spec record, so an engineering owner re-approves it by commenting /approve-spec <full head SHA> on the new head (the author may do so as an engineering owner).
- Extend
useTouchTriggerto cancel the tap's label activation instead of copying its touch-pointer set and press tracking into FieldLabel. - Reword FR9, which says the help opens "on every tap" although a second tap closes it as the Tooltip's touch rules state.
- Add a real-browser check that a tap leaves the text field unfocused, because the jsdom text-field test passes even without the fix.
- Name the accessibility target in the
[fix]changeset as the release rules require, or tag it as an owner-decided behavior change.
[Automated review]
| * The pointers whose tap opens the label's help (`touchTrigger="tap"`): a | ||
| * finger and a pen, the same ones the shared touch trigger answers. | ||
| */ | ||
| const TAP_POINTER_TYPES = new Set(['touch', 'pen']); |
There was a problem hiding this comment.
This is a copy of TOUCH_POINTER_TYPES in Layer/useTouchTrigger.ts:64, and the press tracking below repeats what useTouchTrigger's handlePointerDown already does on this same icon. Extending useTouchTrigger to cancel the tap's default activation under touchTrigger="tap" would let FieldLabel drop both.
| | FR6 | Accepted data, ARIA, DOM, class, style, event, and `xstyle` inputs compose on the label element without replacing the component-owned target or association. When a description renders, the outer wrapper is layout-only and caller props stay on the inner label element. | `architecture:public-component-api/INV5–INV7` | | ||
| | FR7 | The public ref and label-element props MUST describe the element FieldLabel renders in each mode; which root element and public type group mode uses is OQ1. Implementation gap: group mode renders a `<span>` while the public BaseProps and ref types are fixed to `HTMLLabelElement`. | `architecture:public-component-api/INV8,INV9`; current runtime/types | | ||
| | FR8 | The optional tooltip's explanatory content MUST be reachable by keyboard (WCAG 2.2 SC 2.1.1) and its trigger MUST have an accessible name and role (WCAG 2.2 SC 4.1.2). Implementation gap: it anchors to an anonymous, nonfocusable info icon, so the content is pointer-only. | WCAG 2.2 SC 2.1.1, SC 4.1.2; `spec:AST-020/FR1` | | ||
| | FR9 | A tap on the tooltip's info icon, by finger or pen, opens the tooltip on every tap (`touchTrigger="tap"`) and does not activate the associated control. A mouse click on the icon activates the control like the rest of the label, and hover shows the tooltip. | DEC-1 | |
There was a problem hiding this comment.
"opens the tooltip on every tap" contradicts component:Tooltip FR5, under which a second tap on the trigger closes it (and it does, in Chromium on this head). Suggest: the tap opens or closes the tooltip as Tooltip FR5 states for touchTrigger="tap", and does not activate the associated control.
| expect(screen.getByRole('checkbox')).not.toBeChecked(); | ||
| }); | ||
|
|
||
| it('opens the help on a tap of its icon without focusing the field', async () => { |
There was a problem hiding this comment.
This case passes with main's FieldLabel.tsx and with the preventDefault() removed, because jsdom's label activation never focuses a text input, so it cannot back the focus half of FR9's verification row.
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [fix] FieldLabel: a tap on the label's info icon (`labelTooltip`) opens its help without activating the control. Before, the tap that opened the help also activated the label's control, as a tap anywhere on a native label does: on a touch screen it focused the field, raising the keyboard, or toggled the switch or checkbox the label names. Now a tap by finger or pen stops at the help, so touch reaches the help as its own interaction, as every input modality should; a mouse click on the icon still activates the control like the rest of the label, and hover still shows the help. |
There was a problem hiding this comment.
An accessibility [fix] under AST-017 FR53 names the accessibility target it serves (other changesets cite the WCAG criterion or record clause); this one names none, and touch could already reach the help on main.
…nd the changeset's target - FR9 and DEC-1 say a tap opens or closes the help as component:Tooltip FR5 states under touchTrigger="tap", instead of opening it on every tap. - FieldLabelTap.a11y.chromium.spec.ts checks in Chromium that a touch tap on the info icon shows the help and leaves the text field unfocused, and that a mouse click focuses it. The jsdom text-field case, which could not fail, goes. - FieldLabel takes its tap pointers from useTouchTrigger's TOUCH_POINTER_TYPES instead of a copy. - The [fix] changeset names its accessibility target, architecture:interaction-modality INV4.
|
Fixed in 0a6a60f:
FR9 changed, so the record needs |
There was a problem hiding this comment.
Approval waits on an engineering owner's decision on FieldLabel FR9 and DEC-1 as reworded in the latest push: a finger or pen tap on the label's info icon opens or closes its help without activating the control, an exception to the record's "activate eligible controls from the complete visible label area". The earlier approval covered the previous FR9 wording, so an engineering owner records the decision by commenting /approve-spec <full head SHA> on this pull request; the author may do so as an engineering owner. One fix is needed either way:
- The
[fix]changeset namesarchitecture:interaction-modalityINV4 as its accessibility target, but a touch tap already reaches the help on main; name a criterion the current behavior fails, or tag the changeset as the behavior change DEC-1 decides.
[Automated review]
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [fix] FieldLabel: a tap on the label's info icon (`labelTooltip`) opens its help without activating the control. Before, the tap that opened the help also activated the label's control, as a tap anywhere on a native label does: on a touch screen it focused the field, raising the keyboard, or toggled the switch or checkbox the label names. Now a tap by finger or pen stops at the help, so touch reaches the help without operating the control, the operable path `architecture:interaction-modality` INV4 asks of every modality; a mouse click on the icon still activates the control like the rest of the label, and hover still shows the help. |
There was a problem hiding this comment.
INV4 asks that touch "can reach each supported interaction", and a touch tap already opens this help on main (its verification row fails only hover-only, sticky touch hover or unreachable actions). As an AST-017 FR53 [fix], this needs a target the current behavior fails; otherwise it is the behavior change DEC-1 decides, tagged as AST-017 FR1 and FR7 give it ([feat], patch, when no caller must change code).
A tap already reaches the help on main, so the changeset names no interaction-modality target. It describes what FieldLabel FR9 and DEC-1 decide: a tap on the info icon opens the help without also toggling or focusing the control, today's unintended second action.
|
/approve-spec 9e0bf83 |
There was a problem hiding this comment.
Changes requested: the touch behavior works as described, and FR9 and DEC-1 are approved at this head, but the changeset's classification needs one fix. .changeset/fieldlabel-info-icon-tap.md is tagged [fix] and cites only FR9, which this pull request adds; under AST-017 FR5 an intentional change to the documented contract is not a fix unless it is an accessibility fix under FR53 that names the accessibility target it serves. Tag it [feat] with the patch bump (FR7), or name a WCAG 2.2 criterion or current record requirement the current behavior fails, and update the description's FR53 lines to match.
[Automated review]
| '@astryxdesign/core': patch | ||
| --- | ||
|
|
||
| [fix] FieldLabel: a tap on the label's info icon (`labelTooltip`) opens its help without also toggling or focusing the control (`component:FieldLabel` FR9). Before, the tap that opened the help also activated the label's control, as a tap anywhere on a native label does: on a touch screen it focused the field, raising the keyboard, or toggled the switch or checkbox the label names, an unintended second action. Now a tap by finger or pen opens the help alone; a mouse click on the icon still activates the control like the rest of the label, and hover still shows the help. |
There was a problem hiding this comment.
This is tagged [fix], but FR9 is written by this pull request. AST-017 FR5: "A proposal that intentionally replaces the documented contract is not a fix, except an accessibility behavior fix under FR53", and an FR53 fix names the accessibility target the current behavior fails. With no such target, this is the caller-compatible behavior change DEC-1 decides: [feat] with the patch bump (FR7).
FR9 is written by this change, so under spec:AST-017 FR5 the tap is a caller-compatible behavior change that FieldLabel's DEC-1 decides, not an FR53 accessibility fix: a patch [feat] (FR7).
|
/approve-spec 080b3fb |
There was a problem hiding this comment.
This looks ready to merge: a finger or pen tap on a FieldLabel info icon now opens the help without focusing or toggling the control, a mouse click still activates it, and that matches the FieldLabel FR9 and DEC-1 an engineering owner approved at this head. The changeset is now a patch [feat], which is what AST-017 FR7 asks of a caller-compatible behavior change, so nothing further is needed from you.
[Automated review]
…8207) ## User impact On a touch screen, a tap on a disabled Button, IconButton or ToggleButton, or on a disabled menu item, never shows the tooltip that explains why it is disabled. These controls are `aria-disabled` so that they keep their reason reachable, but `touchTrigger="auto"` treats them as an action, so the reason has no touch path. ## Problem and solution fit - **Why it occurs:** `auto` asks whether the trigger performs an action, and an `aria-disabled` control still counts as one. - **Why it harms the task:** a disabled control's reason cannot be read by touch. - **Why that matters:** touch users cannot learn why a control is off, while mouse and keyboard users can. An `aria-disabled` control performs no action. Under `auto`, when the tap's innermost interactive element is an `aria-disabled` control or a label for a disabled control, that element takes the tap. The reason opens and nothing activates. Every other tap is still the trigger's to decide, so taps on enabled controls do not change. A natively `disabled` control receives no `click` from the browser, so this restores the `aria-disabled` path only. ## Expected behavior and authority - `spec:AST-085` FR5: a disabled control's reason is exposed with it. `architecture:interaction-modality` INV4: every modality has an operable path, and hover is never the only discovery path. On touch, that reason had no path. - `component:Tooltip` and `component:HoverCard` DEC-1 and FR5: a disabled control is not an action, so its reason opens on a tap, and that restoration ships on its own as a patch (Compatibility and migration). This pull request is that patch. Tooltip's current-state gap "a disabled control's reason opens on no tap" goes, and both verification rows cite the disabled-control tests; the `auto` walk stays a gap until CLN-0024. Where the records said "a disabled or `aria-disabled` control", they now say "an `aria-disabled` control, or a label for a disabled control": a natively `disabled` control receives no `click` from the browser. - `spec:AST-017` FR53: an accessibility behavior fix ships as a patch `[fix]`, and the changeset names the old and new behavior and its targets. ## Smallest restoration - `isActionTrigger`: a disabled control (`aria-disabled="true"`, or `:disabled`), or a label whose control is disabled, is no action. - `tapLandsOnDisabledControl` walks out from the tapped element on the clickable containers' own walk, `innermostInteractive` in `useClickableContainer`, which `hasInteractiveAncestor` now also uses. It answers one question: whether the innermost interactive element is an `aria-disabled` control or a label for a disabled control. - `isDisabledControl` is one shared predicate in `utils/pressDisabled.ts`, which press feedback (`gestures/haptics.ts`) imports too, so the two never disagree about a control. It stays outside the gesture code, which a public import that uses no gesture never carries, and the CI WebKit lane's scope already covers it. - The `touchTrigger` docs (English and Chinese) for Tooltip, HoverCard, `useTooltip` and `useHoverCard` add the disabled clause, named for `aria-disabled` controls: a natively `disabled` control receives no `click` from the browser. - Lands after #9089, which is merged. ## Evidence - **Before the change:** on main, a tap on a disabled Button with a `tooltip` opens nothing, and so does a tap on a disabled menu item inside a caller's Tooltip. - **After the change:** the reason opens and nothing activates. A tap on a disabled control inside another acting trigger, such as an option row or a link-role card, now opens that trigger's tooltip or hover card. - **Unchanged paths:** mouse hover, `touchTrigger="tap"` and `touchTrigger="none"`. A tap on an enabled control is still decided by the trigger: a truncated label inside a link still opens its tooltip and the link still runs, and a tap inside a default Overlay within a link leaves that link's tooltip shut, as before. The 19 form controls' `disabledMessage` tooltips already opened on a tap, also inside a clickable card, and still do. - **Regression tests:** `touchTriggerTargets.test.tsx` taps every Core disabled-reason tooltip and expects the reason to open with nothing activating. - Button, IconButton and ToggleButton through `tooltip`. - The 19 form controls through `disabledMessage`: CheckboxInput, CheckboxList, DateInput, DateRangeInput, DateTimeInput, FileInput, MultiSelector, NumberInput, PowerSearch, RadioList, SegmentedControl, Selector, Slider, Switch, TextArea, TextInput, TimeInput, Tokenizer and Typeahead. - A disabled menu item through a caller's tooltip, and a disabled field inside a clickable card. - The enabled-link and Overlay guards. - Two HoverCard cases: a tap on an aria-disabled trigger, and on a disabled checkbox inside an option-row trigger, opens the card. - With main's sources, exactly the Button, IconButton, ToggleButton, menu-item and HoverCard cases fail; all pass with this change. - `useTouchTrigger.test.ts` adds the disabled-control rows for `isActionTrigger` and `tapLandsOnDisabledControl`, and `utils/pressDisabled.test.ts` covers `isDisabledControl`. - A disabled Link is not covered: it takes no pointer events, so a tap never reaches it. ## Scope - [x] One defect is restored. - [x] Separable contradictory or unsettled tagalongs were removed or split. - [x] No new public API, visual representation, default, or interaction model is hidden under the bug-fix label. - [x] Public text and artifacts contain no internal Meta context. ## Writing rubric results `Tooltip.spec.md` and `HoverCard.spec.md`: - R1 narration: none; the changed current-state item states what the shipped `auto` still does. - R2 research in the record: none. - R3 evidence naming a change: none; the changed verification cells name test files and cases. - R4 rejected alternatives over one line or outside a decision: none. - R5 pull request or issue references remaining: none. - R6 ruled open questions still listing options: none. ## Testing Local gates at 952974c (on main 66c0d38): - These pass: `pnpm check:repo`, `pnpm check:knowledge`, `pnpm check:changesets`, `pnpm typecheck` (0 errors), ESLint on the touched TypeScript files, Prettier on the touched TypeScript and Markdown files, the root build, and the Storybook build. The touched `.doc.mjs` files keep main's formatting. - `pnpm test:ui`: 17,237 tests pass. - `pnpm test:node`: 14,949 pass, including `touch-support-bundle.test.mjs` (8) and the WebKit lane scope test `ci-interaction-webkit.test.mjs` (12). Its 2 failures, in the release `cache.test.mjs`, are independent of this change (#8520). - `TouchTrigger.a11y.chromium.spec.ts` passes in Chromium, twice (24 of 24).
User need
On a touch screen, a tap on a field label's info icon (
labelTooltip) opens its help and also activates the label's control, because the icon sits inside the<label>. In Chromium with touch, a tap on the info icon of the "Nickname" label opens the help and focuses the field, which on a phone raises the keyboard. Beside a Switch, the tap that opens "Automatically save your changes as you work" also turns auto-save on. Asking what a setting does should not change it.Problem and solution fit
<label>, the icon included, activates the label's control.The icon's tooltip opens or closes on a tap (
touchTrigger="tap"), and a tap by finger or pen stops at the help: its click does not go on to the label. A mouse click on the icon keeps native label activation, and hover still shows the help.Current specification
This is a caller-compatible behavior change that FieldLabel's DEC-1 decides, a patch
[feat]underspec:AST-017FR7: a tap on the info icon opens the help without also toggling or focusing the control, the unintended second action FR9 removes.component:FieldLabellets people "activate eligible controls from the complete visible label area"; this pull request amends that record with FR9 and DEC-1, which give a tap on the info icon to the help, and with the matching end-user impact, tooltip concept, compatibility and verification rows. The amendment needs the record owner's approval.Public delta and caller burden
[feat]underspec:AST-017FR7; it names the old and new tap.labelTooltipdocs of FieldLabel (English and Chinese) and Field describe hover and tap.Design and alternatives
touchTrigger="auto"leave a tap inside a control to that control, a<label>included. WithtouchTrigger="tap", the icon keeps its help on a tap under that rule, so this pull request lands first.<Icon>element, so whichever lands second keeps both props.useTouchTrigger(TOUCH_POINTER_TYPES) and keeps the cancel under its own FR9. A Tooltip-level rule for everytouchTrigger="tap"trigger inside a label belongs to the pending decision on which triggers open on a tap.FieldLabel,labelTooltip,label info iconandlabel activation; only fix(FieldLabel): labelTooltip is an InfoTip button after the label, reachable by keyboard and screen readers #6414 and fix(Tooltip, HoverCard): a disabled control's reason opens on a tap #8207 touch this icon.Evidence
Core/FieldLabelStates story, the Nickname field. With touch, on main a tap on the info icon opens the help and focuses the field; with this change it opens the help, and focus stays off the field. With a mouse, on both, hover shows the help and a click focuses the field.FieldLabelTap.a11y.chromium.spec.tschecks the tap and the click.FieldLabel.tsx, the finger-tap and pen-tap cases fail; with every click on the icon cancelled, the mouse case fails.Scope
Writing rubric results
FieldLabel.spec.md:Testing
Local gates at 0a6a60f (on main 560c666):
pnpm check:repo,pnpm check:knowledge,pnpm typecheck(0 errors), Prettier and ESLint on the touched files, the root build and the Storybook build pass.pnpm test:ui: 16,474 tests pass.pnpm test:node: 14,585 pass; its 4 failures, instory-tree.test.tsand the releasecache.test.mjs, are independent of this change (test(storybook): run the story-tree check where Storybook is built, and bring the tree back to its shape #8509, fix(cli): a crashed run's release install is recognized by the Node it ran on, whatever its name #8520).FieldLabelTap.a11y.chromium.spec.ts: 2 of 2 in Chromium, twice; 24 of 24 with Chromium pinned to two cores at 4 workers, and 40 of 40 pinned to three cores at 16 workers. With main'sFieldLabel.tsxits touch case fails, because the tap focuses the field.FieldLabelAudit.a11y.chromium.spec.ts: 9 of 9 in Chromium, twice.