Skip to content

test(a11y): add hover and pointerAway to the accessibility harness - #7828

Merged
cixzhang merged 3 commits into
mainfrom
test/a11y-harness-pointer
Oct 21, 2026
Merged

cixzhang merged 3 commits into
mainfrom
test/a11y-harness-pointer

Conversation

@cixzhang

@cixzhang cixzhang commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

What this proves

The accessibility harness can now drive a mouse pointer the way a hover-summoned surface needs: hover(subject) rests the pointer on a subject, and pointerAway() moves it off every subject. Contracts for content that hover shows — the Tooltip contract next — use them to prove a hint appears when the pointer rests on its trigger, stays while the pointer moves onto it, and goes when the pointer leaves.

Test-only: no runtime, docs, record, or Changeset change.

Shape

  • internal/a11y-spec/src/harness.ts — two real-browser methods on Harness: hover(subject) and pointerAway().
  • harness/chromium.ts — hover uses the same bounded pointer reach as click, so a subject a pointer can never rest on reports why instead of timing out the test. pointerAway moves the pointer to the first viewport corner or edge midpoint whose hit element is off the subject, its pointer target, and every related subject, and refuses with a legible error when every candidate is covered.
  • harness/jsdom.ts — both report the real-browser layer as unobservable, like click.
  • check.test.ts — the fake harness gains the two no-op methods.
  • harness/chromium.chromium.spec.ts — four self-tests: hovering a subject then a related subject then moving away produces exactly enter, leave, enter, leave; pointerAway skips a corner a related subject covers, and a corner the subject's pointer target covers (each fails if that watch is removed); pointerAway refuses on a page a watched subject fully covers.
  • .github/workflows/ci.yml — "Run accessibility harness self-tests", scoped to harness changes, so a harness change carries its own browser evidence.

Evidence

  • check.test.ts 32/32; tsc (a11y-spec), eslint, Prettier, and the repository pre-push checks clean.
  • Real Chromium: "Run accessibility harness self-tests" on this pull request's pr-a11y job; the first head passed 8/8, and later heads add the related-subject and pointer-target corner cases.

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.

Contracts for hover-shown content (tooltips) need to rest a mouse pointer
on a subject and move it off again. The Chromium harness gains hover(),
bounded like click(), and pointerAway(), which moves the pointer to the
first viewport edge point off the subject and every related subject and
refuses when there is none; jsdom reports both as unobservable. Two
harness self-tests cover them, and a scoped pr-a11y step runs the harness
self-tests whenever the harness changes.
@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:09pm 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
@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, 8:30 PM UTC

@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

No new or modified components detected.

Bundle Size Summary

No component packages changed.

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

46 of 486 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.

Changes requested: hover and pointerAway fit the harness's real-browser layer, but pointerAway() avoids only the semantic subject and related subjects, so for a binding whose pointerTarget covers one of its candidate points, such as the bottom-right corner, it leaves the pointer on the very target hover() used and no leave event fires. Adding pointerLocator to the watched set in internal/a11y-spec/src/harness/chromium.ts fixes this, and all eight harness self-tests still pass with it. Please also add a self-test where a related subject covers the first candidate point, because today both new tests still pass if pointerAway() ignores related subjects.

[Automated review]

[viewport.width / 2, viewport.height - 2],
[viewport.width - 2, viewport.height / 2],
] as const;
const watched = [locator, ...Object.values(options.related ?? {})];

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.

hover(subject) rests on the subject's pointer target (pointerLocator), but this watched set leaves it out. With a binding's pointerTarget anchored over the bottom-right corner, pointerAway() moves onto that target and no mouseleave fires (reproduced in Chromium). Suggested:

const watched = [locator, pointerLocator, ...Object.values(options.related ?? {})];

expect(await (await harness.related('offscreen')).isVisible()).toBe(true);
});

test('hover rests the pointer on a subject and pointerAway moves it off every subject', async ({

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 first candidate corner is already clear on this page, so this test still passes when pointerAway() ignores related subjects. A case with the related subject anchored over the bottom-right corner (position:fixed;right:0;bottom:0) passes on this head and fails under that mutation.

hover() rests on the pointer target, which a binding can set apart from
the semantic subject, so pointerAway() must not land on it. Add a
self-test where a related subject covers the first candidate corner.

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

Changes requested: this head fixes the pointer-target handling in pointerAway() and adds a related-subject test that fails when its check is removed, but no self-test yet fails if pointerAway() stops watching a binding's pointer target. Please add one self-test to internal/a11y-spec/src/harness/chromium.chromium.spec.ts whose harness passes a pointerTarget (for example a label around a checkbox) placed over the bottom-right viewport corner, and assert that the target logs both enter and leave after hover() and pointerAway(). Such a test passes on this head and fails when pointerLocator is removed from the watched set.

[Automated review]

// pointer target can differ from its semantic subject.
const watched = [
locator,
pointerLocator,

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.

Nothing fails if this entry is removed: every pointerAway self-test builds its harness without a pointerTarget, so all nine harness self-tests still pass. A self-test whose pointerTarget (say, a label around a checkbox) covers the bottom-right corner, asserting target+ target- after hover() and pointerAway(), passes on this head and fails without this line.

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

Approval recommended: hover and pointerAway fit the harness's real-browser layer, and this head adds the pointer-target self-test requested on the previous head, which fails if pointerAway() stops avoiding a binding's pointer target. The related-subject and refusal cases are covered the same way, and the new pr-a11y step ran all ten harness self-tests green in Chromium on this head. No further changes are needed.

[Automated review]

@cixzhang
cixzhang merged commit 54b15c6 into main Oct 21, 2026
58 checks passed
@cixzhang
cixzhang deleted the test/a11y-harness-pointer branch October 21, 2026 20:32
@cixzhang
cixzhang restored the test/a11y-harness-pointer branch October 21, 2026 20:32
@cixzhang
cixzhang deleted the test/a11y-harness-pointer branch October 21, 2026 20:33

This branch was successfully deployed

1 active deployment
Preview — 87b1b026 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