mirror of
https://github.com/withastro/astro.git
synced 2025-01-20 22:12:38 -05:00
Fix an issue where audit fails to initialize when encountered <a>
inside <svg>
(#10163)
* Fix an issue where audit fails to initialize when encountered `<a>` inside `<svg>` * Add changeset
This commit is contained in:
parent
d50dddb71d
commit
b92d35f102
2 changed files with 7 additions and 2 deletions
5
.changeset/spotty-cobras-warn.md
Normal file
5
.changeset/spotty-cobras-warn.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
"astro": patch
|
||||
---
|
||||
|
||||
Fixes an issue where audit fails to initialize when encountered `<a>` inside `<svg>`
|
|
@ -338,8 +338,8 @@ export const a11y: AuditRuleWithSelector[] = [
|
|||
selector: a11y_required_content.join(','),
|
||||
match(element: HTMLElement) {
|
||||
// innerText is used to ignore hidden text
|
||||
const innerText = element.innerText.trim();
|
||||
if (innerText !== '') return false;
|
||||
const innerText = element.innerText?.trim();
|
||||
if (innerText && innerText !== '') return false;
|
||||
|
||||
// Check for aria-label
|
||||
const ariaLabel = element.getAttribute('aria-label')?.trim();
|
||||
|
|
Loading…
Add table
Reference in a new issue