Skip to content

fix(a11y): useAriaPropsForRole no longer false-positives on Vue v-bind shorthand 🤖🤖🤖#10568

Merged
dyc3 merged 1 commit into
biomejs:mainfrom
harsha-cpp:fix/use-aria-props-for-role-vue-bindings
Jun 6, 2026
Merged

fix(a11y): useAriaPropsForRole no longer false-positives on Vue v-bind shorthand 🤖🤖🤖#10568
dyc3 merged 1 commit into
biomejs:mainfrom
harsha-cpp:fix/use-aria-props-for-role-vue-bindings

Conversation

@harsha-cpp

Copy link
Copy Markdown
Contributor

Fixes #10564

Summary

useAriaPropsForRole was reporting false positives when required aria attributes were supplied via Vue v-bind shorthand syntax (:aria-checked="value", :aria-level="n", etc.).

The rule checks for missing required aria props by calling find_attribute_by_name, which only inspects HtmlAttribute nodes. Vue v-bind shorthands are parsed as VueVBindShorthandDirective nodes with a structured arg() field — not as HtmlAttribute nodes — so find_attribute_by_name always returned None for them, triggering a spurious diagnostic.

Fix: replace find_attribute_by_name with find_attribute_or_vue_binding, which already handles both plain html attributes and Vue v-bind directives. This is the same pattern used in use_alt_text.rs.

Test Plan

Added valid.vue snapshot test covering :aria-checked, :aria-level, :aria-selected, :aria-valuenow/min/max, and :aria-valuenow for several roles (checkbox, radio, switch, heading, option, slider, meter). All 3 spec tests pass (invalid.html, valid.html, valid.vue).

cargo test -p biome_html_analyze use_aria_props_for_role
# test result: ok. 3 passed; 0 failed

Docs

No documentation changes needed — rule behavior is unchanged for static attributes; this only removes a false positive for dynamic Vue bindings.

This PR was created with AI assistance (Claude Code).

@changeset-bot

changeset-bot Bot commented Jun 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: df5ad33

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

@github-actions

github-actions Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

✅ Organic activity

No automation signals detected in the analyzed events.

View full analysis →

This is an automated analysis by AgentScan

@github-actions github-actions Bot added A-Linter Area: linter L-HTML Language: HTML and super languages labels Jun 5, 2026
@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Worried about impact? Review this PR in Change Stack to explore blast radius before you approve or request changes.

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e000c257-f8e4-4e63-82bf-2af5fb68164c

📥 Commits

Reviewing files that changed from the base of the PR and between a4a294c and df5ad33.

⛔ Files ignored due to path filters (2)
  • crates/biome_html_analyze/tests/specs/a11y/useAriaPropsForRole/valid.html.snap is excluded by !**/*.snap and included by **
  • crates/biome_html_analyze/tests/specs/a11y/useAriaPropsForRole/valid.vue.snap is excluded by !**/*.snap and included by **
📒 Files selected for processing (4)
  • .changeset/fix-use-aria-props-for-role-vue-bindings.md
  • crates/biome_html_analyze/src/lint/a11y/use_aria_props_for_role.rs
  • crates/biome_html_analyze/tests/specs/a11y/useAriaPropsForRole/valid.html
  • crates/biome_html_analyze/tests/specs/a11y/useAriaPropsForRole/valid.vue

Walkthrough

This PR fixes the useAriaPropsForRole rule to correctly recognise Vue v-bind shorthand bindings (:aria-checked, :aria-level, etc.) as satisfying required ARIA attributes. The rule now calls find_attribute_or_vue_binding instead of only checking for static HTML attributes, eliminating false positives. A new Vue test fixture validates the fix across multiple ARIA roles with both static and dynamic bindings.

Possibly related PRs

  • biomejs/biome#10195: Extends the find_attribute_or_vue_binding API that this PR now uses for Vue binding detection in ARIA rules.

Suggested labels

A-Linter, L-HTML

Suggested reviewers

  • ematipico
  • dyc3
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the fix: useAriaPropsForRole no longer reports false positives on Vue v-bind shorthand syntax.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, explaining the bug, root cause, solution, and test coverage.
Linked Issues check ✅ Passed The PR fully addresses issue #10564 by replacing find_attribute_by_name with find_attribute_or_vue_binding to recognise Vue v-bind directives as satisfying required ARIA attributes.
Out of Scope Changes check ✅ Passed All changes directly support the fix: updating the rule logic, adding a Vue test fixture, and recording the changeset. No extraneous modifications detected.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@dyc3 dyc3 added D-Vue Domains: Vue M-Likely Agent Meta: this was likely an automated PR without a human in the loop labels Jun 6, 2026
@codspeed-hq

codspeed-hq Bot commented Jun 6, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 67 untouched benchmarks
⏩ 189 skipped benchmarks1


Comparing harsha-cpp:fix/use-aria-props-for-role-vue-bindings (df5ad33) with main (a4a294c)

Open in CodSpeed

Footnotes

  1. 189 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@dyc3 dyc3 merged commit eb1ed0e into biomejs:main Jun 6, 2026
33 checks passed
@github-actions github-actions Bot mentioned this pull request Jun 6, 2026
@harsha-cpp

Copy link
Copy Markdown
Contributor Author

@dyc3 Thanks

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

Labels

A-Linter Area: linter D-Vue Domains: Vue L-HTML Language: HTML and super languages M-Likely Agent Meta: this was likely an automated PR without a human in the loop

Projects

None yet

Development

Successfully merging this pull request may close these issues.

💅 useAriaPropsForRole false positives in Vue bindings

2 participants