diff --git a/lib/rules/html-lang-valid.json b/lib/rules/html-lang-valid.json
index 19fd4c01c9..5cf81f4325 100644
--- a/lib/rules/html-lang-valid.json
+++ b/lib/rules/html-lang-valid.json
@@ -1,6 +1,6 @@
{
"id": "html-lang-valid",
- "selector": "html[lang], html[xml\\:lang]",
+ "selector": "html[lang]:not([lang=\"\"]), html[xml\\:lang]:not([xml\\:lang=\"\"])",
"tags": ["cat.language", "wcag2a", "wcag311", "ACT"],
"actIds": ["bf051a"],
"metadata": {
diff --git a/test/integration/virtual-rules/html-lang-valid.js b/test/integration/virtual-rules/html-lang-valid.js
index d89d410ca6..8e7675a7a2 100644
--- a/test/integration/virtual-rules/html-lang-valid.js
+++ b/test/integration/virtual-rules/html-lang-valid.js
@@ -6,6 +6,21 @@ describe('html-lang-valid virtual-rule', function() {
attributes: {}
});
+ assert.lengthOf(results.inapplicable, 1);
+ assert.lengthOf(results.passes, 0);
+ assert.lengthOf(results.violations, 0);
+ assert.lengthOf(results.incomplete, 0);
+ });
+
+ it('is inapplicable with empty lang or xml:lang', function() {
+ // Error caught by html-has-lang instead
+ var results = axe.runVirtualRule('html-lang-valid', {
+ nodeName: 'html',
+ attributes: {
+ 'lang': '',
+ }
+ });
+
assert.lengthOf(results.inapplicable, 1);
assert.lengthOf(results.passes, 0);
assert.lengthOf(results.violations, 0);