diff --git a/src/compiler/compile/nodes/Element.ts b/src/compiler/compile/nodes/Element.ts
index a3030f52a581..999b4df8e1bb 100644
--- a/src/compiler/compile/nodes/Element.ts
+++ b/src/compiler/compile/nodes/Element.ts
@@ -451,11 +451,12 @@ export default class Element extends Node {
if (this.name === 'input') {
const type = attribute_map.get('type');
if (type && type.get_static_value() === 'image') {
- should_have_attribute(
- this,
- ['alt', 'aria-label', 'aria-labelledby'],
- 'input type="image"'
- );
+ const required_attributes = ['alt', 'aria-label', 'aria-labelledby'];
+ const has_attribute = required_attributes.some(name => attribute_map.has(name));
+
+ if (!has_attribute) {
+ should_have_attribute(this, required_attributes, 'input type="image"');
+ }
}
}
}
diff --git a/test/validator/samples/a11y-alt-text/input.svelte b/test/validator/samples/a11y-alt-text/input.svelte
index f17638af769c..1c3b5ac5ce8f 100644
--- a/test/validator/samples/a11y-alt-text/input.svelte
+++ b/test/validator/samples/a11y-alt-text/input.svelte
@@ -6,4 +6,6 @@
-
\ No newline at end of file
+
+
+