Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/shaggy-phones-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

Fix false negative for a11y_consider_explicit_label with popover elements
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,12 @@ function has_content(element) {
}

if (node.type === 'RegularElement' || node.type === 'SvelteElement') {
// FIX START: Ignore elements with the popover attribute
if (node.attributes.some((a) => a.type === 'Attribute' && a.name === 'popover')) {
continue;
}
// FIX END

if (
node.name === 'img' &&
node.attributes.some((node) => node.type === 'Attribute' && node.name === 'alt')
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<button interestfor="verified-hint">
<svg width="16" height="16" viewBox="0 0 24 24"><path d="M23,12L20.56,9.22L20.9,5.54L17.29,4.72L15.4,1.54L12,3L8.6,1.54L6.71,4.72L3.1,5.53L3.44,9.21L1,12L3.44,14.78L3.1,18.47L6.71,19.29L8.6,22.47L12,21L15.4,22.46L17.29,19.28L20.9,18.46L20.56,14.78L23,12M10,17L6,13L7.41,11.59L10,14.17L16.59,7.58L18,9L10,17Z" /></svg>
<div id="verified-hint" popover="hint">
Verified
</div>
</button>

<style>
button {
margin: 1rem;
}

[popover] {
position-area: block-start center;
margin: 0;
}
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"code": "a11y_consider_explicit_label",
"message": "Buttons and links should either contain text or have an `aria-label`, `aria-labelledby` or `title` attribute",
"start": { "line": 1, "column": 0 },
"end": { "line": 6, "column": 11 }
}
]
Loading