tabindex-no-positive

pull/815/head
Rich Harris 8 years ago
parent 915c1835a4
commit 85e9ed9a81

@ -78,6 +78,14 @@ export default function a11y(
validator.warn(`A11y: The scope attribute should only be used with <th> elements`, attribute.start);
}
// tabindex-no-positive
if (name === 'tabindex') {
const value = getStaticAttributeValue(node, 'tabindex');
if (!isNaN(value) && +value > 0) {
validator.warn(`A11y: avoid tabindex values above zero`, attribute.start);
}
}
attributeMap.set(attribute.name, attribute);
});

@ -0,0 +1,4 @@
<div tabindex='-1'/>
<div tabindex='0'/>
<div tabindex='1'/>
<div tabindex='{{foo}}'/>

@ -0,0 +1,10 @@
[
{
"message": "A11y: avoid tabindex values above zero",
"loc": {
"line": 3,
"column": 5
},
"pos": 46
}
]
Loading…
Cancel
Save