Merge pull request #3332 from Conduitry/gh-3331

fix erroneous a11y warning with input type='image'
pull/3342/head
Rich Harris 5 years ago committed by GitHub
commit 9e1554610b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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"');
}
}
}
}

@ -6,4 +6,6 @@
<object></object>
<input type='image'>
<input type='image'>
<input type='image' alt='hey'>

Loading…
Cancel
Save