Skip to content

test(a11y): add Tooltip contract and bind Tooltip - #7799

Merged
cixzhang merged 1 commit into
mainfrom
test/a11y-tooltip-contract
Oct 21, 2026
Merged

cixzhang merged 1 commit into
mainfrom
test/a11y-tooltip-contract

Conversation

@cixzhang

@cixzhang cixzhang commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

What this proves

Tooltip and useTooltip now have an executable Tooltip contract and a binding. A keyboard, screen-reader, or mouse user meeting an Astryx tooltip gets: a popup with the tooltip role; a trigger whose aria-describedby names that popup, so the browser computes the tooltip's text into the trigger's description; the tooltip shown when they Tab onto the trigger and kept while focus stays there; Escape hiding it without moving focus or the pointer, whether focus or hover showed it; the tooltip gone when focus leaves; the tooltip shown when they rest the pointer on the trigger, and kept while the pointer stays there or moves onto the tooltip itself; and (advisory) the tooltip gone when the pointer leaves both.

Test-only: no runtime, docs, record, or Changeset change. component:Tooltip is a draft record, so AST-021 FR12's evidence backlink does not apply.

Adoption source. spec:AST-020 FR15 (current) adopts the parts it names: Tooltip plays the tooltip role, so it takes the role and the aria-describedby relationship. A tooltip is not a composite control, so it gains no arrow or Home/End keys. WCAG 2.2 is the primary source for the other required rows: 2.1.1 (keyboard focus reaches the hint, focus stays on the trigger) and 1.4.13 AA (the focus-shown tooltip persists while focus stays; Escape dismisses; hover content stays while hovered — applying only where hover can show the tooltip). The pattern's blur dismissal, hover showing and mouse-out hiding are not among the parts FR15 names and component:Tooltip is draft, so those three rows are advisory (AST-020 FR9) until a current record adopts them. No behavior changes; every expectation describes what Tooltip does today.

Expectations (AST-020 FR13)

Expectation Sources Layer Enforcement
tooltip.surface.role WCAG 4.1.2, APG Tooltip role dom required
tooltip.trigger.described-by-tooltip WCAG 1.3.1, APG Tooltip aria-describedby dom required
tooltip.trigger.description WCAG 4.1.2, APG Tooltip aria-describedby accessibility-tree (+dom) required
tooltip.focus.shows-on-keyboard-focus WCAG 2.1.1, WCAG 1.4.13 (persistent), APG Tooltip definition and "focus stays on the triggering element", spec:AST-020 FR15 real-browser required
tooltip.keys.escape-dismisses WCAG 1.4.13, APG Tooltip Escape real-browser required (hover arm when hover shows it)
tooltip.focus.leaving-hides APG Tooltip onBlur note (supports 2.4.11) real-browser advisory
tooltip.hover.shows-on-hover APG Tooltip definition (supports 1.4.13, 2.1.1) real-browser advisory (when hover shows it)
tooltip.hover.stays-while-hovered WCAG 1.4.13, APG Tooltip "remains open as long as the cursor is over the trigger or the tooltip" real-browser required (when hover shows it)
tooltip.hover.leaving-hides APG Tooltip "disappears … on mouse out" (supports 1.4.13) real-browser advisory (when hover shows it)

Exemptions name an owner for every other checklist dimension: the trigger's own role, name, activation and pointer behavior → the trigger's own pattern (button, link); content inside a tooltip, including that it holds nothing focusable → caller content (interactive hover content is a non-modal dialog such as HoverCard); touch and press-to-hide → the binding's own tests (remainder only); placement and focus-obscured geometry → the layer runtime and the page; paint, contrast, forced colors, motion → the component styling, layer animations and theme; page title, language, onward Tab order → the page; status messages → the status-message pattern and AST-009.

Bindings and states

State What it exercises
wrapped-button <Tooltip> around a Button: the Button becomes the described trigger
text-trigger <Tooltip> around plain text: Tooltip renders its own focusable inline trigger
anchor-ref-with-hint <Tooltip anchorRef> on a caller button already described by a visible hint: aria-describedby carries both
use-tooltip-hook useTooltip on a caller button with the hook's ref and describedBy

Known failures: none. The first Chromium run on this PR found every state failing tooltip.hover.stays-while-hovered — a pointer moving straight from the trigger onto the tooltip hid it — and #7802 has since fixed that on main (the surface's React onMouseEnter ran before the trigger's native mouseleave scheduled the hide). This branch is rebased on that fix, so the row passes and no ledger is needed.

Not adopted here, each with its owner

  • focusTrigger 'always' / 'never': 24 core hosts pass 'always' — the disabledMessage tooltips on the field and choice controls, the Slider value bubble and ProgressBar marks — so focus on the control inside a non-focusable wrapper shows the hint; the described and focused elements differ, so each host's own suite proves its keyboard path (for example TextInput.test.tsx "shows the reason tooltip on keyboard focus"). 'never' hands focus to a composite widget that owns how a keyboard user reaches the hint; no shipped composition uses it. Every state uses the default 'auto'.
  • Touch (touchTrigger): there is no hover on a finger; useTooltip.test.tsx and Tooltip.test.tsx touch suites through useTouchTrigger.
  • Controlled (isOpen) and disabled (isEnabled) tooltips: visibility belongs to the caller; the controlled and disabled suites.
  • Interactive hover content (HoverCard, popovers): not a tooltip; reviewed separately.
  • Host compositions (IconButton label tooltip, the useInputStatusIcon on-field status tooltip, Lab InfoTip): they render Tooltip or useTooltip, which this binding proves; the host's additions are the host's.
  • Placement, alignment, surface paint, text-trigger underline: layout and paint; Tooltip.test.tsx, layer anchor tests and the visual gate.

Harness

The hover rows use the harness hover(subject) and pointerAway() primitives, which landed with their self-tests in #7828.

Duplicate assertions (AST-021 FR6)

  • Rewritten: Tooltip.test.tsx "gives the tooltip layer role="tooltip" linked from the trigger" becomes "renders the content prop inside the tooltip layer": its role and aria-describedby checks are owned by tooltip.surface.role and tooltip.trigger.described-by-tooltip on every binding state in the jsdom lane, inside the required test gate; the content assertion stays. Mutation checks: hard-coding the layer role to status fails all four binding states; dropping the wrapped-element aria-describedby write fails wrapped-button.
  • Kept, each with its reason: TooltipHoverBridge.a11y.chromium.spec.ts ("a one-step move from the trigger onto the tooltip keeps it open", from fix(Tooltip): keep the tooltip open when the pointer crosses onto it in one step #7802) proves the same outcome as tooltip.hover.stays-while-hovered, but its pr-a11y step runs on every pull request while this binding's step runs only when Tooltip, its stories, or the contract change; it stays until the binding's step runs unscoped or in a required gate. Tooltip.test.tsx and useTooltip.test.tsx hover-delay, Escape-through-the-layer-stack, touch, controlled-state and placement tests run with fake timers in jsdom; the contract's browser rows that cover the same user outcomes run only in the non-required pr-a11y job, scoped to Tooltip changes, so the jsdom tests stay until that lane is a required gate.

Shape

  • internal/a11y-spec/src/patterns/tooltip.ts — TOOLTIP_PATTERN: 9 expectations; APG wording checked against the published pattern on 2026-10-21.
  • tooltip.fixtures.ts — a plain HTML tooltip on a trigger between two page buttons, in four conforming (one shown by focus only, which claims no hover) and fourteen violating forms (including a focus-only tooltip that hides itself while focus stays); every expectation has at least one violating twin.
  • tooltip.jsdom.test.ts and tooltip.chromium.spec.ts — the contract self-test in both lanes.
  • packages/core/src/Tooltip/__tests__/Tooltip.a11y.{states,renders,test}.ts(x) and Tooltip.a11y.chromium.spec.ts — the four states above.
  • apps/storybook/stories/TooltipA11y.stories.tsx — one no-visual story per state, rendered from the shared renders so the lanes cannot drift.
  • .github/workflows/ci.yml — "Run Tooltip accessibility contract" step plus its evidence upload; runs when Tooltip, the stories, or the contract change.
  • README tree line and pattern row, index export.

Evidence

  • Contract jsdom self-test and binding jsdom lane pass (DOM rows pass; tree and browser rows reported unrun); Tooltip directory green. Mutation check: dropping aria-describedby from the use-tooltip-hook trigger fails that binding state.
  • tsc (a11y-spec, core), eslint, Prettier, and the repository pre-push checks clean.
  • Real Chromium, head e58a320 (pr-a11y, "Run Tooltip accessibility contract"): contract fixtures (4 conforming pass every applicable row, every violating check fails its own expectation), every expectation exercised, and all four Tooltip states pass every row. Earlier heads: 917f380 found the hover-bridge defect fix(Tooltip): keep the tooltip open when the pointer crosses onto it in one step #7802 has since fixed. This head splits the harness into test(a11y): add hover and pointerAway to the accessibility harness #7828 with no change to the contract or binding; its pr-a11y run re-proves them. The pr-a11y axe audit reported 0 issues on the four new stories.

Scope

  • No intended public API, product behavior, visual direction, record, or policy change.
  • Product changes discovered during the work were removed or split.
  • Public text and artifacts contain no internal Meta context.

@astracat-bot

astracat-bot Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
🟢 Reviewed (for maintainers only) Oct 21, 2026, 9:05 PM UTC

@vercel

vercel Bot commented Oct 21, 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 Oct 21, 2026 8:40pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 21, 2026
@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

Modified Components

Tooltip (@astryxdesign/core) · View in Storybook
Metric Before After Delta
Bundle Size (ESM) N/A N/A N/A
Lines of Code N/A 559 -
Complexity N/A Very High (62) -

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.9KB 1.2KB

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

46 of 488 shot(s) changed.

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
Selector Indicator Space Bottom Sheet Narrow End RTL neutral light 753,933
Selector Indicator Space Bottom Sheet Wide Start neutral light 740,072
Chat Full AI Chat probe light 230,823
Chat Full AI Chat probe dark 229,805
RichTextEditor Markdown parity: side by side probe dark 94,866
RichTextEditor Markdown parity: side by side probe light 89,762
Collapsible Dividers probe dark 66,445
Collapsible Dividers probe light 66,445
Chat Default neutral dark 36,304
Chat Default neutral light 35,767
Chat Empty State probe light 23,531
Chat Empty State probe dark 22,622
ChatAutoScroll Scroll Behavior Comparison neutral dark 15,378
ChatAutoScroll Scroll Behavior Comparison neutral light 14,107
Chat With Attachments probe light 13,406
Chat With Attachments probe dark 11,232
ProgressBar With Target Mark probe dark 7,895
ProgressBar With Target Mark probe light 7,895
Markdown Default neutral dark 7,573
Markdown Default neutral light 7,566

and 26 more.


Generated by PR Enrichment workflow | Storybook | Sandbox | 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.

The tooltip contract and binding are well evidenced on this head, and the hover-bridge failure is recorded exactly; approval now waits on a maintainer decision about two expectations. A maintainer needs to identify the current record that adopts "focus leaving the trigger hides the tooltip" and "hovering the trigger shows it" as required outcomes, since spec:AST-020 FR15 names the role, name, state and relationship properties and Tab plus Enter or Space activation and component:Tooltip is still draft, or have tooltip.focus.leaving-hides and tooltip.hover.shows-on-hover report as advisory until it does. Two test changes are needed either way:

  • Add focusTrigger to the binding inventory, as a state or as an exclusion naming its owner, because 'never' turns off the required keyboard-focus row (AST-021 FR4).
  • Drop or rewrite the role and aria-describedby assertions in Tooltip.test.tsx:87-98, which the binding's jsdom lane now owns inside the required test gate, or name a removal blocker for them (AST-021 FR6).

[Automated review]

appliesWhen: ALWAYS,
evidenceLayer: 'real-browser',
alsoNeeds: ['dom'],
enforcement: 'required',

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 row gates as required with spec:AST-020 FR15 as its only primary source. FR15's text adopts the role, the accessible name, the state and relationship properties, and activation by Tab plus Enter or Space, and leaves naming the adopted parts to the owning component record; component:Tooltip is still draft, and family:overlay-dismissal AV4 leaves focus-loss dismissal to the member. Approval waits on a maintainer identifying the current record that adopts this outcome, or on this row reporting as advisory (with advisoryBecause) like tooltip.hover.leaving-hides.

appliesWhen: ALWAYS,
evidenceLayer: 'real-browser',
alsoNeeds: ['dom'],
enforcement: 'required',

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.

Same question as tooltip.focus.leaving-hides: no WCAG criterion is cited and FR15's text does not name showing on hover, so required here needs a current adopting record, or an advisory classification until component:Tooltip names it.

},
] as const satisfies ReadonlyArray<TooltipBindingState>;

export const TOOLTIP_EXCLUSIONS = [

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.

focusTrigger ('auto' | 'always' | 'never') decides whether Tab onto the trigger shows the tooltip (useTooltip.tsx:489-497), but no state binds it and this list does not exclude it. With 'never', the required keyboard-focus row cannot pass. AST-021 FR4 asks for a state, or an exclusion that names its owner and reason, plus its id in the inventory test.

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

Making focus-leaving and hover-showing advisory settles the earlier spec question, and the contract, fixtures and binding pass in Chromium on this head with the hover-bridge failure recorded exactly. A few changes are still needed before this can be approved:

  • The focus-trigger exclusion says no shipped composition passes focusTrigger: 'always', but 24 core call sites do for their disabled-reason tooltips (for example TextInput.tsx:358 and Switch.tsx:607), so bind an 'always' state or name those hosts and the tests that own their keyboard path (AST-021 FR4).
  • Removing the duplicate test in Tooltip.test.tsx also dropped its content text assertion, which no binding row covers in jsdom, so keep that assertion locally (AST-021 FR5 and FR6).
  • internal/a11y-spec/README.md still lists focus leaving and hover showing as gating outcomes adopted under AST-020 FR15; mark them advisory there.
  • At 2,033 authored lines the change is larger than one review should carry; landing the harness hover() and pointerAway() primitives with their self-tests first brings it under 2,000.

[Automated review]

{
id: 'focus-trigger',
owner:
"the caller that passes focusTrigger 'never' or 'always' (no shipped Astryx composition does), and the focusTrigger prop docs in Tooltip.doc.mjs",

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 says no shipped composition passes focusTrigger: 'always', but 24 Tooltip and useTooltip call sites in packages/core/src do (for example TextInput.tsx:358, Switch.tsx:607, CheckboxInput.tsx:376) for their disabled-reason tooltips, where focusin bubbling from the focused control is the only keyboard path to the hint (useTooltip.tsx:489-497). AST-021 FR4 needs that state bound, or an exclusion that names those hosts and the tests that own their keyboard path.

</Tooltip>,
);
const layer = screen.getByRole('tooltip', {hidden: true});
expect(layer).toHaveTextContent('Tooltip text');

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 content assertion is component-specific (the public content prop reaching the layer), and no binding row proves it in jsdom; AST-021 FR6 asks for the test to be rewritten to keep it rather than deleted with the role and aria-describedby checks.

Comment thread internal/a11y-spec/README.md Outdated
| `menu-button` | [APG Menu Button](https://www.w3.org/WAI/ARIA/apg/patterns/menu-button/) required parts; the optional ArrowDown/ArrowUp opens Astryx ships are advisory | Anchored DropdownMenu and MoreMenu triggers: button role and name, `aria-haspopup="menu"`, `aria-expanded`, `aria-controls`, Enter/Space open on the first enabled item (advisory: ArrowDown on the first, ArrowUp on the last) |
| `menu` | [APG Menu and Menubar](https://www.w3.org/WAI/ARIA/apg/patterns/menubar/) menu; arrows (with wrap) and Home/End per AST-020 FR15; typeahead advisory | DropdownMenu pointer menu: named `menu`, item roles/names, `aria-checked`, `aria-disabled`, arrows with wrap, Home/End, Enter and Escape back to the trigger, Tab out (advisory: typeahead) |
| `toolbar` | [APG Toolbar](https://www.w3.org/WAI/ARIA/apg/patterns/toolbar/); arrows (with wrap) and Home/End per AST-020 FR15 | Toolbar: named `toolbar`, `aria-orientation`, controls inside it, one Tab stop entering on the first enabled control, next/previous arrows (RTL-mirrored, Down/Up when vertical) with wrap, Home/End |
| `tooltip` | [APG Tooltip](https://www.w3.org/WAI/ARIA/apg/patterns/tooltip/) required parts per AST-020 FR15; WCAG 2.2 1.4.13; pointer leaving advisory | Tooltip and useTooltip: `tooltip` role, trigger `aria-describedby` and computed description, keyboard focus shows it with focus kept on the trigger, Escape dismisses (focus- and hover-shown), focus leaving hides, hover shows and keeps it over the trigger and the tooltip (advisory: pointer leaving hides) |

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.

tooltip.focus.leaving-hides and tooltip.hover.shows-on-hover are advisory at this head, but this row (and the tree line at line 57) still lists them as bound outcomes under "required parts per AST-020 FR15"; mark them advisory, the way the accordion row names its advisory rows.

cixzhang added a commit that referenced this pull request Oct 21, 2026
…in one step (#7802)

<!-- template: bug-fix.md -->

## User impact

A mouse user who moves straight from a Tooltip's trigger onto the tooltip, in one pointer step across the small gap as a quick hand does, sees the tooltip disappear about a tenth of a second after the pointer lands on it. They cannot rest on it to read it or magnify it. A slow move that pauses in the gap keeps it open, so the failure depends on hand speed. Every `Tooltip` and `useTooltip` attachment shares this hover handling.

## Problem and solution fit

- Why it happens: `useTooltip` cancels its pending hide in the tooltip surface's React `onMouseEnter`. React derives that event from the browser's `mouseout`, which on a single pointer step fires before the trigger's native `mouseleave`. So the order is cancel, then schedule: the trigger's leave schedules the 100 ms hover-bridge hide after it was already cancelled, and it runs.
- Why it harms: the tooltip closes under the pointer even though the pointer is on it.
- Why that matters: WCAG requires hover content to stay while the pointer is over it, and the hook's hover bridge exists for exactly this case.

The trigger's leave now checks where the pointer went (`relatedTarget`). When that is inside the tooltip surface, it does not schedule a hide; the surface's own mouse leave schedules one when the pointer leaves the tooltip. Every other leave behaves as before.

## Expected behavior and authority

- `spec:AST-020` FR1 (current): WCAG 2.2 Level A and AA are the conformance baseline. 1.4.13 Content on Hover or Focus (AA), Hoverable: "the pointer can be moved over the additional content without the additional content disappearing".
- APG Tooltip pattern: the tooltip remains open while the cursor is over the trigger or the tooltip.
- The hook already promises this: its hover bridge is documented as letting the pointer travel from the trigger onto the tooltip surface for WCAG 1.4.13.
- The Tooltip accessibility contract in #7799 records this as a known failure in every Tooltip state (`tooltip.hover.stays-while-hovered`).

## Smallest restoration

- `useTooltip`'s trigger `mouseleave` handler skips `scheduleHide()` when `relatedTarget` is inside the tooltip surface (looked up by the layer id in the pointer target's own document).
- No prop, default, timing, or visual change. Focus, tap, controlled `isOpen`, and explicit `hideDelay` paths are untouched.

## Evidence

- Reproduction before the change: in Chromium, on the Tooltip Default story, hover the trigger until the tooltip shows, then move the mouse onto the tooltip in one step. The tooltip hides within ~100 ms (3/3 runs).
- Result after the change: the same move leaves the tooltip open after 400 ms (3/3 runs).
- Representative unchanged path: moving off the tooltip onto the page still hides it, before and after the change; the existing hover-bridge, hide-delay and touch tests pass unchanged.
- Regression test or other mutation-sensitive proof:
  - `TooltipHoverBridge.a11y.chromium.spec.ts` (real Chromium, real mouse input) fails on `main` and passes here; it runs in the `pr-a11y` job.
  - A `useTooltip.test.tsx` case dispatches the browser's order (`mouseout`, then a raw `mouseleave`, both pointing at the tooltip) and fails on `main`.

Note for #7799: once this lands, that PR's known-failure records for `tooltip.hover.stays-while-hovered` become unexpected passes. Whichever of the two lands second should delete them.

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

## Testing

- `pnpm exec vitest run packages/core/src/Tooltip`: 2 files, 47 tests pass; the new case fails without the fix.
- Playwright Chromium against built Storybooks of this branch and of `main`'s `useTooltip`: one-step crossing passes 3/3 here, fails 3/3 on `main`; leaving the tooltip hides it in both.
- `pnpm -F @astryxdesign/core typecheck`, ESLint, Prettier, `pnpm check:changesets`: pass.
@cixzhang
cixzhang force-pushed the test/a11y-tooltip-contract branch from 03c83f0 to 83c87dc Compare October 21, 2026 17:12

@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 earlier requests are all addressed, and the Tooltip contract and binding now pass every row in all four states in Chromium. One change is still needed before approval: TooltipHoverBridge.a11y.chromium.spec.ts ("a one-step move from the trigger onto the tooltip keeps it open") checks the same outcome as the binding's required tooltip.hover.stays-while-hovered row in the same pr-a11y job, so either remove that test or list it under "Duplicate assertions (AST-021 FR6)" with its removal blocker (for example, that its step runs on every pr-a11y run while the binding's step is path-scoped). A small, non-blocking correction: the focus-trigger exclusion counts Timestamp, which passes focusTrigger="always" to HoverCard, and leaves out the Slider value-bubble <Tooltip focusTrigger="always">.

[Automated review]

},
},
{
id: 'tooltip.hover.stays-while-hovered',

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 required row now proves the outcome packages/core/src/Tooltip/__tests__/TooltipHoverBridge.a11y.chromium.spec.ts:53-64 asserts ("a one-step move from the trigger onto the tooltip keeps it open"), at the same real-browser layer and in the same pr-a11y job. AST-021 FR6 asks the migration to remove or rewrite that local test, or to name its removal blocker; the "Duplicate assertions" ledger does neither. Naming the blocker (for example, that the hover-bridge step runs on every pr-a11y run while this binding's step is path-scoped) or deleting that one test settles it.

{
id: 'focus-trigger',
owner:
"the 24 core hosts that pass focusTrigger 'always' — the disabledMessage tooltips on the field and choice controls (TextInput, TextArea, NumberInput, Switch, CheckboxInput, CheckboxList, RadioList, Selector, MultiSelector, SegmentedControl, Slider, Typeahead, Tokenizer, FileInput, and the date and time inputs), ProgressBar marks and Timestamp — each through its own suite (for example TextInput.test.tsx 'shows the reason tooltip on keyboard focus'); and any caller that passes 'never'",

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: Timestamp's focusTrigger="always" goes to HoverCard (Timestamp/TimestampHoverCard.tsx:253), which the interactive-hover-content exclusion already assigns elsewhere, while the Slider value bubble's <Tooltip focusTrigger="always"> (Slider/Slider.tsx:1020) is not named. Swapping the two keeps the count of 24 Tooltip and useTooltip call sites accurate.

@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 Tooltip contract and binding are well evidenced: every row passes in all four states in Chromium, and the description now names each retained duplicate test with its removal blocker. One change is needed before approval: WCAG 1.4.13's "Persistent" requirement is checked only for hover, so the keyboard row never checks that the tooltip stays, and a focus-only tooltip that hides itself while focus stays on the trigger passes every required row. Please add a required check (or extend tooltip.focus.shows-on-keyboard-focus) that waits after Tab and asserts the tooltip is still visible with focus kept, with a focus-only fixture that hides itself as its violating twin; all four Tooltip states already keep the tooltip open, so it should pass with no known failure.

[Automated review]

},
},
{
id: 'tooltip.focus.shows-on-keyboard-focus',

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.

WCAG 1.4.13 "Persistent" also covers content that keyboard focus shows: it must stay visible until focus leaves, the user dismisses it, or it is no longer valid. This row stops once the tooltip appears with focus kept, and tooltip.hover.stays-while-hovered checks persistence only when hover shows the tooltip, so the contract's own violating-times-out fixture passes this row and a focus-only tooltip that hides itself 500 ms after Tab passes every required row. Please add a required row (or a PERSIST_MS wait here) asserting the tooltip is still visible with focus on the trigger, with a focus-only self-hiding fixture as its violating twin in TOOLTIP_MUTATIONS (AST-020 FR5, FR9, FR10). All four Tooltip states already pass it.

verifiedBy:
"the layer runtime's anchor-placement tests and page-level review of sticky surfaces",
reason:
'The tooltip is placed beside its trigger by the layer runtime, so whether it or another surface hides a focused control is placement and page geometry; this contract proves it leaves when focus does.',

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: tooltip.focus.leaving-hides is advisory, so the contract reports that the tooltip leaves when focus does but never gates it; "reports" would be accurate here and in the 2.1.2 exemption's verifiedBy (line 580).

owner:
"the composing components' own contracts (Button for the IconButton label tooltip, the field status binding for FieldStatus) and their tests",
reason:
'IconButton, FieldStatus and Lab InfoTip render Tooltip or useTooltip for their own purposes; this binding proves the tooltip they render, and what each host adds around it is that host.',

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: FieldStatus renders no tooltip (packages/core/src/FieldStatus/FieldStatus.tsx:138-139); the on-field status tooltip comes from useInputStatusIcon (packages/core/src/hooks/useInputStatusIcon.tsx:153), so that is the host to name 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 Tooltip contract and binding are well evidenced, and the keyboard row's new persistence check closes the last gap: every row passes in all four Tooltip states in Chromium. One change is needed before approval: at 2,004 authored lines this pull request is over the 2,000-line limit for a single review, so please land the harness hover() and pointerAway() primitives and their two self-tests in their own pull request first, which leaves about 1,870 lines here. While rebasing, the description's “Not adopted here” list should name useInputStatusIcon instead of FieldStatus, and its Evidence section should report this head's run. The failing test check comes from an unrelated packages/cli timing test (cache.test.mjs), so a rerun should clear it.

[Automated review]

@cixzhang
cixzhang force-pushed the test/a11y-tooltip-contract branch from e58a320 to 2b2240d Compare October 21, 2026 19:04
@cixzhang
cixzhang changed the base branch from main to test/a11y-harness-pointer October 21, 2026 19:04
@cixzhang
cixzhang force-pushed the test/a11y-tooltip-contract branch from 2b2240d to a616d2c Compare October 21, 2026 19:34
@cixzhang
cixzhang force-pushed the test/a11y-tooltip-contract branch from a616d2c to d2e32e5 Compare October 21, 2026 20:02
@cixzhang
cixzhang force-pushed the test/a11y-tooltip-contract branch from d2e32e5 to c1849dc Compare October 21, 2026 20:32
@cixzhang
cixzhang requested a review from potatowagon as a code owner October 21, 2026 20:32
@cixzhang
cixzhang deleted the branch test/a11y-harness-pointer October 21, 2026 20:32
@cixzhang cixzhang closed this Oct 21, 2026
@cixzhang cixzhang reopened this Oct 21, 2026
@cixzhang
cixzhang changed the base branch from test/a11y-harness-pointer to main October 21, 2026 20:33
TOOLTIP_PATTERN encodes the APG Tooltip pattern's role and relationship
under AST-020 FR15 and WCAG 2.2 2.1.1 and 1.4.13: the tooltip role, the
trigger described by it, keyboard focus showing it and keeping it while
focus stays, Escape dismissing it whether focus or hover showed it, and
hover keeping it while the pointer rests on the trigger or the tooltip.
Blur dismissal, hover showing and pointer-leave hiding report as advisory.

Binds Tooltip (wrapped element, text, anchorRef) and useTooltip in four
no-visual states with a scoped pr-a11y step, and rewrites the
Tooltip.test.tsx role/aria-describedby test the binding now owns down to
its content assertion. Builds on the harness hover/pointerAway primitives.
Test-only.

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

Recommending approval: all nine tooltip rows pass in every Tooltip binding state in real Chromium at this head, the earlier requested changes are in, and nothing here changes Tooltip's runtime behavior. One small, non-blocking fix to the description: its duplicate-assertion ledger says the binding's browser step runs when the Chromium harness changes, but the step's scope pattern in .github/workflows/ci.yml no longer includes the harness, so either drop that clause (and name the hover-bridge spec's second test, which stays the only gate for pointer-leave hiding) or add internal/a11y-spec/src/harness to the pattern.

[Automated review]

Comment thread .github/workflows/ci.yml
&& git show "$BASE_SHA:.github/scripts/pr-scope-touches.sh" > "$helper"; then
scope=0
bash "$helper" "$BASE_SHA" \
'^(internal/a11y-spec/src/patterns/tooltip\.|packages/core/src/Tooltip/|apps/storybook/stories/TooltipA11y)' || scope=$?

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 pattern does not include internal/a11y-spec/src/harness, but the description's duplicate-assertion ledger says the binding's step also runs when the Chromium harness changes. Either drop that clause from the description (and name TooltipHoverBridge's second test, which stays the only gate for pointer-leave hiding), or add the harness path here, as the Slider, Tree View, Alert Dialog, Grid and Window Splitter steps do.

@cixzhang
cixzhang merged commit ca4f3b2 into main Oct 21, 2026
58 checks passed
@cixzhang
cixzhang deleted the test/a11y-tooltip-contract branch October 21, 2026 21:08

This branch was successfully deployed

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

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant