Skip to content
Merged
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/tall-avocados-repair.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'svelte': patch
---

fix: silence a11y warning for inert elements
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,10 @@ export function check_element(node, context) {
switch (node.name) {
case 'a':
case 'button': {
const is_hidden = get_static_value(attribute_map.get('aria-hidden')) === 'true';
const is_hidden =
get_static_value(attribute_map.get('aria-hidden')) === 'true' ||
get_static_value(attribute_map.get('inert')) !== null;

if (!has_spread && !is_hidden && !is_labelled && !has_content(node)) {
w.a11y_consider_explicit_label(node);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<a href="/#" aria-label="Valid empty link"></a>

<button aria-hidden='true'></button>
<button inert></button>
<a href="/#" aria-hidden='true'><b></b></a>

<button>Click me</button>
Expand Down
Loading