feat(a11y): add warning missing lang on html tag

pull/828/head
jpsc 7 years ago
parent cc7bf6fca3
commit 8639359aa7

@ -143,6 +143,11 @@ export default function a11y(
shouldHaveAttribute(['title']);
}
// html-has-lang
if (node.name === 'html') {
shouldHaveAttribute(['lang']);
}
// no-distracting-elements
if (node.name === 'marquee' || node.name === 'blink') {
validator.warn(`A11y: Avoid <${node.name}> elements`, node.start);
@ -168,4 +173,4 @@ function getValue(attribute: Node) {
if (attribute.value.length === 1 && attribute.value[0].type === 'Text') return attribute.value[0].data;
return null;
}
}

@ -0,0 +1,5 @@
<html lang="en"></html>
<html lang="en-US"></html>
<html lang={language}></html>
<html></html>

@ -0,0 +1,10 @@
[
{
"loc": {
"column": 0,
"line": 5
},
"message": "A11y: <html> element should have a lang attribute",
"pos": 82
}
]
Loading…
Cancel
Save