diff --git a/src/validate/html/a11y.ts b/src/validate/html/a11y.ts
index dd1755b0c7..0b34c9b451 100644
--- a/src/validate/html/a11y.ts
+++ b/src/validate/html/a11y.ts
@@ -73,6 +73,11 @@ export default function a11y(
validator.warn(`A11y: Avoid using autofocus`, attribute.start);
}
+ // scope
+ if (name === 'scope' && node.name !== 'th') {
+ validator.warn(`A11y: The scope attribute should only be used with
elements`, attribute.start);
+ }
+
attributeMap.set(attribute.name, attribute);
});
diff --git a/test/validator/samples/a11y-scope/input.html b/test/validator/samples/a11y-scope/input.html
new file mode 100644
index 0000000000..b7738ba7da
--- /dev/null
+++ b/test/validator/samples/a11y-scope/input.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/test/validator/samples/a11y-scope/warnings.json b/test/validator/samples/a11y-scope/warnings.json
new file mode 100644
index 0000000000..684a75dad6
--- /dev/null
+++ b/test/validator/samples/a11y-scope/warnings.json
@@ -0,0 +1,10 @@
+[
+ {
+ "message": "A11y: The scope attribute should only be used with | elements",
+ "loc": {
+ "line": 1,
+ "column": 5
+ },
+ "pos": 5
+ }
+]
|