diff --git a/.changeset/fix-use-semantic-elements-base-concepts.md b/.changeset/fix-use-semantic-elements-base-concepts.md new file mode 100644 index 000000000000..b840878c8735 --- /dev/null +++ b/.changeset/fix-use-semantic-elements-base-concepts.md @@ -0,0 +1,5 @@ +--- +"@biomejs/biome": patch +--- + +Fixed [#9245](https://github.com/biomejs/biome/issues/9245): the [`useSemanticElements`](https://biomejs.dev/linter/rules/use-semantic-elements/) rule no longer suggests `` for `role="status"` and `role="alert"`. The `` element is only a `relatedConcept` of these roles, not a direct semantic equivalent. These roles are now excluded from suggestions, aligning with the intended behavior of the upstream `prefer-tag-over-role` rule. diff --git a/crates/biome_js_analyze/src/lint/a11y/use_semantic_elements.rs b/crates/biome_js_analyze/src/lint/a11y/use_semantic_elements.rs index 99460050c3f6..394170c0c87d 100644 --- a/crates/biome_js_analyze/src/lint/a11y/use_semantic_elements.rs +++ b/crates/biome_js_analyze/src/lint/a11y/use_semantic_elements.rs @@ -42,6 +42,7 @@ declare_lint_rule! { /// <> /// label ///
+ ///
/// ; /// ``` /// @@ -97,9 +98,17 @@ impl Rule for UseSemanticElements { // For the following roles, the associated elements are impractical: // - combobox: - 43 │ {/* Constrained elements: tag matches but required attributes are missing */} - > 44 │ + 42 │ {/* Constrained elements: tag matches but required attributes are missing */} + > 43 │ │ ^^^^^^^^^^^^^^^ - 45 │ - 46 │ + 44 │ + 45 │ i For examples and more information, see WAI-ARIA Roles @@ -694,17 +675,17 @@ invalid.jsx:44:12 lint/a11y/useSemanticElements ━━━━━━━━━━ ``` ``` -invalid.jsx:45:12 lint/a11y/useSemanticElements ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.jsx:44:12 lint/a11y/useSemanticElements ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × The elements with this role can be changed to the following elements: - 43 │ {/* Constrained elements: tag matches but required attributes are missing */} - 44 │ - > 45 │ + 42 │ {/* Constrained elements: tag matches but required attributes are missing */} + 43 │ + > 44 │ │ ^^^^^^^^^^^^ - 46 │ - 47 │ + 45 │ + 46 │ i For examples and more information, see WAI-ARIA Roles @@ -712,17 +693,17 @@ invalid.jsx:45:12 lint/a11y/useSemanticElements ━━━━━━━━━━ ``` ``` -invalid.jsx:46:12 lint/a11y/useSemanticElements ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.jsx:45:12 lint/a11y/useSemanticElements ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × The elements with this role can be changed to the following elements: - 44 │ - 45 │ - > 46 │ + 43 │ + 44 │ + > 45 │ │ ^^^^^^^^^^^^^^^^ - 47 │ - 48 │ + 46 │ + 47 │ i For examples and more information, see WAI-ARIA Roles @@ -730,18 +711,18 @@ invalid.jsx:46:12 lint/a11y/useSemanticElements ━━━━━━━━━━ ``` ``` -invalid.jsx:47:12 lint/a11y/useSemanticElements ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ +invalid.jsx:46:12 lint/a11y/useSemanticElements ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ × The elements with this role can be changed to the following elements: