Repository navigation
fix: skip unnamed forms in landmark navigation - #267
Merged
Merged
Conversation
cmorten
approved these changes
Oct 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
AI-generated, not reviewed by a human. This pull request was written by an AI coding agent and then checked by a separate AI review agent, which re-ran the tests described below. No human has reviewed the code. It is submitted by @monsterlag, who runs these agents. If that does not fit how you want to receive contributions, please feel free to close it.
Issue
Partially addresses #253.
Details
Following the conclusion in #253 that an unnamed
<form>keeps theformrole but is not exposed as a landmark,moveToNextLandmark/moveToPreviousLandmarkno longer stop on a form that has no accessible name. Named forms (e.g.<form aria-label="Checkout">) are still landmarks and are still navigated to.Changes:
GetIndexFiltersgains an optionalrolesRequiringAccessibleNamefilter, checked by a newmatchesAccessibleNameRequirementmatcher innodeMatchers.ts. A node whose role is in that list only matches when it has an accessible name.["form"]for it (with a comment citing HTML-AAM and WAI-ARIA 1.3).form/end of formwhen stepping through, matching the issue discussion.Scope note:
moveToNextForm/moveToPreviousFormare left as they are, since they navigate byformrole and the unnamed form still has that role. Happy to apply the same filter to them if you would rather they only target form landmarks. I have not looked for the "other bits" mentioned in the issue, hence "Partially addresses".CheckList
Added two cases to
test/int/moveToRole.int.test.ts(nav+ unnamedform+main): before the change the second landmark move landed onform; after it, it lands onmain, Content(next) andnavigation, Primary(previous).Commands run:
npx jest test/int/moveToRole.int.test.ts: 2 failed / 48 passed before the fix, 50 passed after.yarn lint: passes.npx tsc --noEmit -p tsconfig.json: no errors.yarn test:coverage: 58 suites, 340 tests passed; coverage thresholds met (all files 98.35% statements, 95.14% branches, 100% functions).