Repository navigation
test(a11y): add Link contract bound to Link and its router seams - #7378
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewNo new or modified components detected. Bundle Size Summary
Accessibility AuditStatus: No accessibility violations detected. Visual Regression44 of 448 shot(s) changed. A change here is a question, not a failure: check whether the after is the
and 24 more. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
There was a problem hiding this comment.
Recommending approval: the new link contract and Link binding follow the repository's accessibility spec-test authoring and migration rules, leave Link's runtime behavior and public API unchanged, and the contract's fixture proof plus all six Link states pass in Chromium for this revision. No changes are needed from you before maintainer review.
[Automated review]
* ci(a11y): scope PR evidence steps by the merge-base diff The Link, Landmark, ToggleButton and RichText parity evidence steps decided PR scope with a two-dot diff from the base branch's tip. On a branch cut before the base gained a file, that diff lists the file as deleted by the PR: since the Link contract landed (#7378), every older PR ran the Link step against spec files missing at its head and failed pr-a11y with 'No tests found' until rebased. pr-scope-touches.sh diffs from the PR's merge base instead (fetching 200 commits of history), and an unknown merge base still runs the evidence, as an unfetchable base did before. * ci(a11y): load the PR scope helper from the base A pull_request run takes its step bodies from the merge commit while pr-a11y checks out the PR head, so a branch cut before the helper landed would not have it: bash would exit 127, read as unknown, and run every gated suite (still failing older-than-Link branches). The four steps now load pr-scope-touches.sh from BASE_SHA, as check-scope loads its policy scripts. The helper also exits 2 (unknown) rather than 1 for unusable arguments or an invalid pattern. * ci(a11y): find the PR merge base at any branch age; count renames A fixed 200-commit fetch left branches further behind main without a merge base, so every gated suite ran (and pre-Link branches still failed). The helper now deepens in 200-commit steps until git merge-base succeeds, and exits 2 only when history is complete and still unrelated. --no-renames lists both sides of a move, so moving a matching file out of a pattern still counts as touching it.
Maintainer impact
Keyboard, speech-input, and screen-reader users depend on every Astryx link being announced as a link, carrying the name its caller gave it, joining the tab sequence, and following its destination exactly once from Enter or a completed press — whether a native anchor or an app's router component renders it. Link's local tests assert props and destination handling, but no reusable contract proved those outcomes in a real engine, and later adopters (breadcrumbs, side and top navigation, citations, clickable cards) had nothing shared to bind to.
Intended invariant
AST-020 governs contract authoring, AST-021 governs binding, and AST-009 bounds tree and browser evidence away from real-AT claims.
family:navigation-destinationskeeps destination safety and FR7 member-owned disabled semantics out of this contract.This PR preserves Link runtime behavior and public API. Every gate is a WCAG 2.2 Level A outcome; the APG Link pattern supplies the exact role and Enter mechanics those outcomes rest on. No APG-only detail gates.
Change
Link contract
link.role.exposedlink.name.exposedlink.name.matches-visible-labellink.focus.reachable-and-escapablelink.navigation.runs-on-enterlink.navigation.completes-on-releaselink.current.exposedEvery expectation has deliberately violating fixtures: a navigating span and button (role), an unnamed icon and a replaced name (name), a name that drops the visible words (label in name),
tabindex="-1"(Tab), a click-onlyrole="link"and a double navigation on Enter (Enter), navigation on pointer-down and a cancelled pointer click (release), and a missing or unearnedaria-current(current). Every other AST-020 dimension names its owner.Navigation is observed, not inferred: the browser half counts navigation requests through the Navigation API and cancels them so the page stays mounted; router states count their own navigations; new tabs are counted as opened pages.
First binding: Link
text-nativeicon-labelledcurrent-pagearia-current="page"external-new-tabprovider-routeras-routerasDisabled and href-less Links, destination safety, navigation aggregates, and visual treatment are recorded exclusions with owners. A scoped
pr-a11ystep runs the contract and binding in Chromium when Link, its a11y stories, or the contract change, and uploads the JSON report.Evidence
LINK_PATTERNexisted; the contract suite failed on the missing module. The first browser run also showed fixture links onabout:blanknever navigate and the new-tab state needs time for the opened page to arrive; both are fixed at head.eb7600ea8e3edc8007f88a7b04372d633f51d02e, thepr-a11ylink step ran 22 Chromium tests with 22 passing: three conforming fixtures, twelve deliberate mutations each failing for its own reason, the exercise check, and all six Link states (run 38264669425, artifactlink-contract-evidence-eb7600e, report SHA-2564f14ffd737ae757bd35121fe4cc2ee1afe542b4eb15e1167bb084a9246382127).label,isExternalLink,newTabLabel, disabled, and router-substitution props (AST-021 FR5).Scope
Not adopted here: BreadcrumbItem, SideNavItem, TopNavItem, Citation, and ClickableCard link bindings; disabled-link semantics; speech or AT activation claims.
Testing
pnpm vitest run --project node internal/a11y-spec/src/patterns/link.jsdom.test.tspnpm vitest run --project ui packages/core/src/Linkpnpm -F @astryxdesign/a11y-spec typecheckandpnpm -F @astryxdesign/core typecheckpr-a11ylink step, 22/22 passing.