Skip to content

fix(landmark-unique): correct form/section landmark calculation#5086

Closed
WilcoFiers wants to merge 1 commit into
developfrom
unique-form-fix
Closed

fix(landmark-unique): correct form/section landmark calculation#5086
WilcoFiers wants to merge 1 commit into
developfrom
unique-form-fix

Conversation

@WilcoFiers

Copy link
Copy Markdown
Contributor

The landmark-unique-matches function used an outdated approach to finding landmarks. I noticed that looking at #5085, which tried to patch the problem. The better solve is to use the existing code for finding larndmarks.

Closes: #4722, closes #5064

Copilot AI review requested due to automatic review settings April 29, 2026 12:31
@WilcoFiers WilcoFiers requested a review from a team as a code owner April 29, 2026 12:31
@WilcoFiers WilcoFiers closed this Apr 29, 2026

Copilot AI 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.

Pull request overview

Updates landmark-unique-matches to rely on the shared ARIA role-type logic for landmark detection, fixing incorrect matching for <section>/<form> when explicit non-landmark roles are present and ensuring explicit landmark roles are handled consistently.

Changes:

  • Replace custom landmark detection in lib/rules/landmark-unique-matches.js with getRoleType(vNode) === 'landmark'.
  • Refactor and expand tests for <section>/<form> matching behavior, including explicit landmark and explicit non-landmark role cases.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
lib/rules/landmark-unique-matches.js Simplifies landmark matching by using the central getRoleType logic, aligning behavior with existing implicit-role/name rules.
test/rule-matches/landmark-unique-matches.js Refactors the section/form tests into per-element suites and adds coverage for explicit landmark vs non-landmark roles.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +44 to +45
describe(`${elementType} must have accessible names to be matched`, () => {
it(`should match with a label`, () => {

Copilot AI Apr 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The describe title says the element "must have accessible names to be matched", but this suite also includes a case that should match without a label when an explicit landmark role is present. Consider renaming the suite to reflect the actual behavior being tested (implicit section/form landmark mapping requires a name; explicit landmark roles match regardless of name) to avoid confusion when reading test output.

Copilot uses AI. Check for mistakes.
@WilcoFiers

Copy link
Copy Markdown
Contributor Author

Didn't mean to open this as. PR. I was just testing.

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.

landmark-unique does not match <form role="search"> without an accessible name Mis-identification of landmark role, false positive for unique AccName

2 participants