diff --git a/.changeset/quiet-areas-link.md b/.changeset/quiet-areas-link.md
new file mode 100644
index 0000000000..af4e31f3cb
--- /dev/null
+++ b/.changeset/quiet-areas-link.md
@@ -0,0 +1,5 @@
+---
+'svelte': patch
+---
+
+fix: don't warn about a redundant `link` role on `` elements without an `href`
diff --git a/packages/svelte/src/compiler/phases/2-analyze/visitors/shared/a11y/index.js b/packages/svelte/src/compiler/phases/2-analyze/visitors/shared/a11y/index.js
index f06a41d088..c38b03bf69 100644
--- a/packages/svelte/src/compiler/phases/2-analyze/visitors/shared/a11y/index.js
+++ b/packages/svelte/src/compiler/phases/2-analyze/visitors/shared/a11y/index.js
@@ -173,8 +173,8 @@ export function check_element(node, context) {
current_role === get_implicit_role(node.name, attribute_map) &&
//
is ok because CSS list-style:none removes the semantics and this is a way to bring them back
!['ul', 'ol', 'li', 'menu'].includes(node.name) &&
- // is ok because without href the a tag doesn't have a role of link
- !(node.name === 'a' && !attribute_map.has('href'))
+ // and are ok because without href they don't have a role of link
+ !((node.name === 'a' || node.name === 'area') && !attribute_map.has('href'))
) {
w.a11y_no_redundant_roles(attribute, current_role);
}
diff --git a/packages/svelte/tests/validator/samples/a11y-no-redundant-roles/input.svelte b/packages/svelte/tests/validator/samples/a11y-no-redundant-roles/input.svelte
index 9e06ebe420..68965fb5f4 100644
--- a/packages/svelte/tests/validator/samples/a11y-no-redundant-roles/input.svelte
+++ b/packages/svelte/tests/validator/samples/a11y-no-redundant-roles/input.svelte
@@ -43,6 +43,11 @@
+
+
+
+
+
diff --git a/packages/svelte/tests/validator/samples/a11y-no-redundant-roles/warnings.json b/packages/svelte/tests/validator/samples/a11y-no-redundant-roles/warnings.json
index e041037d71..8e94fef00a 100644
--- a/packages/svelte/tests/validator/samples/a11y-no-redundant-roles/warnings.json
+++ b/packages/svelte/tests/validator/samples/a11y-no-redundant-roles/warnings.json
@@ -454,5 +454,17 @@
"column": 8,
"line": 44
}
+ },
+ {
+ "code": "a11y_no_redundant_roles",
+ "end": {
+ "column": 26,
+ "line": 47
+ },
+ "message": "Redundant role 'link'",
+ "start": {
+ "column": 15,
+ "line": 47
+ }
}
]