diff --git a/.changeset/few-mails-kiss.md b/.changeset/few-mails-kiss.md new file mode 100644 index 000000000000..6bf4fed23986 --- /dev/null +++ b/.changeset/few-mails-kiss.md @@ -0,0 +1,5 @@ +--- +"astro": patch +--- + +Fixes a false positive for "Invalid `tabindex` on non-interactive element" rule for roleless elements ( `div` and `span` ). diff --git a/packages/astro/src/runtime/client/dev-toolbar/apps/audit/rules/a11y.ts b/packages/astro/src/runtime/client/dev-toolbar/apps/audit/rules/a11y.ts index 27da9b011e0d..6d07f36e0ac7 100644 --- a/packages/astro/src/runtime/client/dev-toolbar/apps/audit/rules/a11y.ts +++ b/packages/astro/src/runtime/client/dev-toolbar/apps/audit/rules/a11y.ts @@ -513,7 +513,11 @@ export const a11y: AuditRuleWithSelector[] = [ if (!isInteractive(element)) return false; - if (!interactiveElements.includes(element.localName)) return true; + if ( + !interactiveElements.includes(element.localName) && + !roleless_elements.includes(element.localName) + ) + return true; }, }, {