Skip to content

fix(linter): treat separator role as non-interactive for hr elements#9039

Closed
solssak wants to merge 1 commit intobiomejs:mainfrom
solssak:fix/hr-presentation-role-9024
Closed

fix(linter): treat separator role as non-interactive for hr elements#9039
solssak wants to merge 1 commit intobiomejs:mainfrom
solssak:fix/hr-presentation-role-9024

Conversation

@solssak
Copy link

@solssak solssak commented Feb 12, 2026

Summary

Fixes #9024.

<hr role="presentation"> incorrectly triggers noInteractiveElementToNoninteractiveRole because the separator role (implicit role of <hr>) inherits from widget, causing it to be classified as interactive.

Per the WAI-ARIA spec, the separator role is only interactive when the element is focusable (e.g. has tabindex and aria-valuenow). A non-focusable <hr> is a static structural element.

Changes

  • Added Separator to the exception list in AriaRole::is_interactive() (same pattern as the existing Progressbar exception).
  • Added <hr role="presentation" /> and <hr role="none" /> to valid test cases.
  • Updated snapshot.

Test plan

  • cargo test -p biome_js_analyze -- no_interactive_element_to_noninteractive_role — 2 passed
  • cargo test -p biome_js_analyze -- no_noninteractive_element_to_interactive_role — 2 passed
  • cargo test -p biome_aria_metadata — all passed

AI assistance disclosure

This PR was authored with AI assistance (Claude Code) for codebase exploration, analysis, and implementation.

The separator ARIA role inherits from both structure and widget, but
per WAI-ARIA spec it is only interactive when focusable (with tabindex
and aria-valuenow). A non-focusable separator like <hr> is a static
structural element and should not trigger
noInteractiveElementToNoninteractiveRole.

Closes biomejs#9024
@changeset-bot
Copy link

changeset-bot bot commented Feb 12, 2026

🦋 Changeset detected

Latest commit: 88d47b0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@solssak
Copy link
Author

solssak commented Feb 12, 2026

Closing as duplicate — @LouisLau-art already has PR #9028 for this. Apologies for the overlap!

@solssak solssak closed this Feb 12, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 12, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

This patch fixes the noInteractiveElementToNoninteractiveRole linter rule to correctly handle <hr> elements assigned role="presentation" or role="none". The fix treats the implicit Separator role (associated with <hr>) as non-interactive when non-focusable, aligning with WAI-ARIA specifications. Changes include updating the is_interactive check to exclude Separator from widget-based roles and adding test cases validating the corrected behaviour.

Suggested labels

A-Linter, L-JavaScript

Suggested reviewers

  • ematipico
  • dyc3
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Linter Area: linter L-JavaScript Language: JavaScript and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

💅 hr tag with role="presentation" throws lint/a11y/noInteractiveElementToNoninteractiveRole

1 participant