Biome lint rule falsely flagged accessible SVGs using JSX boolean shorthand
A bug reported in Biome's noSvgWithoutTitle lint rule caused it to incorrectly flag SVG elements that used the JSX boolean shorthand aria-hidden, despite those elements being properly hidden from the accessibility tree. The root cause was in the Rust source file no_svg_without_title.rs, where the guard checking for aria-hidden called as_static_value(), a helper that first looks for an attribute initializer — the equals-sign-and-value portion of an attribute. Because the bare shorthand aria-hidden carries no initializer, the helper short-circuited and returned None before the 'true' comparison could ever run, causing valid code to be treated as unflagged. The fix was a single line — aria_hidden_attr.initializer()? — which returns early from the rule with no diagnostic the moment it detects a shorthand attribute, while leaving existing behavior for aria-hidden='true' and aria-hidden={true} unchanged. New test cases were added to the rule's spec file to confirm the shorthand and its explicit equivalents all pass validation correctly.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in