Skip to content

fix: skip unnamed forms in landmark navigation - #267

Merged
cmorten merged 1 commit into
guidepup:mainfrom
monsterlag:fix/issue-253-2e47
Oct 22, 2026
Merged

cmorten merged 1 commit into
guidepup:mainfrom
monsterlag:fix/issue-253-2e47

Conversation

@monsterlag

Copy link
Copy Markdown
Contributor

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 the form role but is not exposed as a landmark, moveToNextLandmark / moveToPreviousLandmark no 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:

  • GetIndexFilters gains an optional rolesRequiringAccessibleName filter, checked by a new matchesAccessibleNameRequirement matcher in nodeMatchers.ts. A node whose role is in that list only matches when it has an accessible name.
  • The two landmark commands pass ["form"] for it (with a comment citing HTML-AAM and WAI-ARIA 1.3).
  • Spoken output is unchanged, so an unnamed form is still read as form / end of form when stepping through, matching the issue discussion.

Scope note: moveToNextForm / moveToPreviousForm are left as they are, since they navigate by form role 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

  • Has been tested (where required). (Automated checks only, listed below.)

Added two cases to test/int/moveToRole.int.test.ts (nav + unnamed form + main): before the change the second landmark move landed on form; after it, it lands on main, Content (next) and navigation, 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).

@cmorten
cmorten merged commit 1a42dee into guidepup:main Oct 22, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants