Skip to content

fix: let aria-label be valid for useHeadingContent.#3767

Merged
Conaclos merged 4 commits intobiomejs:mainfrom
anthonyshew:shew-08f3d
Sep 4, 2024
Merged

fix: let aria-label be valid for useHeadingContent.#3767
Conaclos merged 4 commits intobiomejs:mainfrom
anthonyshew:shew-08f3d

Conversation

@anthonyshew
Copy link
Copy Markdown
Contributor

@anthonyshew anthonyshew commented Sep 3, 2024

Summary

An aria-label can be used to set what a screen reader uses for a heading element, even when the heading element doesn't have content available in its "a11y tree" (e.g. children nodes of the element). There is one exception where a heading tag can have both aria-label and aria-hidden, which also removes it from the "a11y tree".

The logic introduced in this PR reflects the above.

Test Plan

I've updated the snapshots to reflect what should be a valid and invaild use of aria-label.

@github-actions github-actions Bot added A-Linter Area: linter L-JavaScript Language: JavaScript and super languages A-Changelog Area: changelog labels Sep 3, 2024
Comment thread CHANGELOG.md
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Just taking the opportunity to remove whitespaces I left in my other fix lines. 😄

Comment thread crates/biome_js_analyze/src/lint/a11y/use_heading_content.rs Outdated
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Sep 3, 2024

CodSpeed Performance Report

Merging #3767 will not alter performance

Comparing anthonyshew:shew-08f3d (d9eb234) with main (35e9e6d)

Summary

✅ 99 untouched benchmarks

Copy link
Copy Markdown
Member

@Conaclos Conaclos left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks!

@Conaclos Conaclos merged commit e1e6de7 into biomejs:main Sep 4, 2024
@anthonyshew anthonyshew changed the title fix: let aria-label be valid for useHeadingContent. fix: let aria-label be valid for useHeadingContent. Sep 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants