diff --git a/src/validate/html/a11y.ts b/src/validate/html/a11y.ts index df1a644bf6..d06ba4ce7c 100644 --- a/src/validate/html/a11y.ts +++ b/src/validate/html/a11y.ts @@ -65,7 +65,12 @@ export default function a11y( // no-access-key if (name === 'accesskey') { - validator.warn(`A11y: Avoid using the accessKey attribute`, attribute.start); + validator.warn(`A11y: Avoid using accesskey`, attribute.start); + } + + // no-autofocus + if (name === 'autofocus') { + validator.warn(`A11y: Avoid using autofocus`, attribute.start); } attributeMap.set(attribute.name, attribute); diff --git a/test/validator/samples/a11y-no-access-key/warnings.json b/test/validator/samples/a11y-no-access-key/warnings.json index fe09930c29..40a8381aed 100644 --- a/test/validator/samples/a11y-no-access-key/warnings.json +++ b/test/validator/samples/a11y-no-access-key/warnings.json @@ -1,5 +1,5 @@ [{ - "message": "A11y: Avoid using the accessKey attribute", + "message": "A11y: Avoid using accesskey", "loc": { "line": 1, "column": 5 diff --git a/test/validator/samples/a11y-no-autofocus/input.html b/test/validator/samples/a11y-no-autofocus/input.html new file mode 100644 index 0000000000..769dbe8c5b --- /dev/null +++ b/test/validator/samples/a11y-no-autofocus/input.html @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/test/validator/samples/a11y-no-autofocus/warnings.json b/test/validator/samples/a11y-no-autofocus/warnings.json new file mode 100644 index 0000000000..26544e9afc --- /dev/null +++ b/test/validator/samples/a11y-no-autofocus/warnings.json @@ -0,0 +1,8 @@ +[{ + "message": "A11y: Avoid using autofocus", + "loc": { + "line": 1, + "column": 5 + }, + "pos": 5 +}] \ No newline at end of file