From 951feeae4eb5285539080e9dcdd558571e9ef19f Mon Sep 17 00:00:00 2001 From: Kate Higa <16447748+khiga8@users.noreply.github.com> Date: Mon, 10 Jul 2023 13:18:50 -0400 Subject: [PATCH 01/19] bump aria-query to 5.3.0 --- package-lock.json | 31 ++++++++++++++++++++++--------- package.json | 2 +- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/package-lock.json b/package-lock.json index c6157798..93a2cbd7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@github/browserslist-config": "^1.0.0", "@typescript-eslint/eslint-plugin": "^5.1.0", "@typescript-eslint/parser": "^5.1.0", - "aria-query": "^5.1.3", + "aria-query": "^5.3.0", "eslint-config-prettier": ">=8.0.0", "eslint-plugin-escompat": "^3.3.3", "eslint-plugin-eslint-comments": "^3.2.0", @@ -682,11 +682,11 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" }, "node_modules/aria-query": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.1.3.tgz", - "integrity": "sha512-R5iJ5lkuHybztUfuOAznmboyjWq8O6sqNqtK7CLOqdydi54VNbORp49mb14KbWgG1QD3JFO9hJdZ+y4KutfdOQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", + "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", "dependencies": { - "deep-equal": "^2.0.5" + "dequal": "^2.0.3" } }, "node_modules/array-includes": { @@ -1182,6 +1182,14 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==", + "engines": { + "node": ">=6" + } + }, "node_modules/diff": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", @@ -4944,11 +4952,11 @@ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" }, "aria-query": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.1.3.tgz", - "integrity": "sha512-R5iJ5lkuHybztUfuOAznmboyjWq8O6sqNqtK7CLOqdydi54VNbORp49mb14KbWgG1QD3JFO9hJdZ+y4KutfdOQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", + "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", "requires": { - "deep-equal": "^2.0.5" + "dequal": "^2.0.3" } }, "array-includes": { @@ -5298,6 +5306,11 @@ "object-keys": "^1.1.1" } }, + "dequal": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz", + "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==" + }, "diff": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", diff --git a/package.json b/package.json index c8f8e0d1..50151ced 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "@github/browserslist-config": "^1.0.0", "@typescript-eslint/eslint-plugin": "^5.1.0", "@typescript-eslint/parser": "^5.1.0", - "aria-query": "^5.1.3", + "aria-query": "^5.3.0", "eslint-config-prettier": ">=8.0.0", "eslint-plugin-escompat": "^3.3.3", "eslint-plugin-eslint-comments": "^3.2.0", From 95c60cf78628d7ae56b813b41593af591ce04794 Mon Sep 17 00:00:00 2001 From: Kate Higa <16447748+khiga8@users.noreply.github.com> Date: Mon, 10 Jul 2023 13:20:48 -0400 Subject: [PATCH 02/19] Don't delete all of attributes --- lib/rules/role-supports-aria-props.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/rules/role-supports-aria-props.js b/lib/rules/role-supports-aria-props.js index 55644c1f..370bb696 100644 --- a/lib/rules/role-supports-aria-props.js +++ b/lib/rules/role-supports-aria-props.js @@ -9,7 +9,10 @@ const elementRolesMap = new ObjectMap() for (const [key, value] of elementRoles.entries()) { // - Remove unused `constraints` key delete key.constraints - key.attributes = key.attributes?.filter(attribute => !('constraints' in attribute)) + // - Remove `constraints` key within `attributes` + for (const attribute of key.attributes || []) { + delete attribute.constraints + } // - Remove empty `attributes` key if (!key.attributes || key.attributes?.length === 0) { delete key.attributes From 762f7e123f2074c542874c8d7e2a47e0e14dad76 Mon Sep 17 00:00:00 2001 From: Kate Higa <16447748+khiga8@users.noreply.github.com> Date: Mon, 10 Jul 2023 13:36:44 -0400 Subject: [PATCH 03/19] `a` and `area` without `href` are now generic, - generic does not list `aria-checked`. --- tests/role-supports-aria-props.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/role-supports-aria-props.js b/tests/role-supports-aria-props.js index c0676d6a..1858b9cf 100644 --- a/tests/role-supports-aria-props.js +++ b/tests/role-supports-aria-props.js @@ -57,9 +57,6 @@ ruleTester.run('role-supports-aria-props', rule, { {code: ''}, {code: ''}, - // this will have global - {code: ''}, - // AREA TESTS - implicit role is `link` {code: ''}, {code: ''}, @@ -78,9 +75,6 @@ ruleTester.run('role-supports-aria-props', rule, { {code: ''}, {code: ''}, - // this will have global - {code: ''}, - // LINK TESTS - implicit role is `link` {code: ''}, {code: ''}, @@ -348,6 +342,14 @@ ruleTester.run('role-supports-aria-props', rule, { invalid: [ // implicit basic checks + { + code: '', + errors: [getErrorMessage('aria-checked', 'generic')], + }, + { + code: '', + errors: [getErrorMessage('aria-checked', 'generic')], + }, { code: '', errors: [getErrorMessage('aria-checked', 'link')], From 2747f2da177afd2255b0ed73f09546a0f238b535 Mon Sep 17 00:00:00 2001 From: Kate Higa <16447748+khiga8@users.noreply.github.com> Date: Mon, 10 Jul 2023 13:39:59 -0400 Subject: [PATCH 04/19] link tag maps to nothing - according to https://www.w3.org/TR/html-aam-1.0/, link tag doesn't map to anything even with an href. - therefore, it no longer makes sense to try to determine role and evaluate, so it should be skipped. - accordingly, tests are deleted since we don't want to evaluate it. --- tests/role-supports-aria-props.js | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/tests/role-supports-aria-props.js b/tests/role-supports-aria-props.js index 1858b9cf..a7658712 100644 --- a/tests/role-supports-aria-props.js +++ b/tests/role-supports-aria-props.js @@ -75,27 +75,6 @@ ruleTester.run('role-supports-aria-props', rule, { {code: ''}, {code: ''}, - // LINK TESTS - implicit role is `link` - {code: ''}, - {code: ''}, - {code: ''}, - {code: ''}, - {code: ''}, - {code: ''}, - {code: ''}, - {code: ''}, - {code: ''}, - {code: ''}, - {code: ''}, - {code: ''}, - {code: ''}, - {code: ''}, - {code: ''}, - {code: ''}, - - // this will have global - {code: ''}, - // this will have role of `img` {code: ''}, @@ -338,6 +317,7 @@ ruleTester.run('role-supports-aria-props', rule, { {code: ''}, {code: '
'}, {code: ''}, + {code: ''}, // link maps to nothing ], invalid: [ @@ -358,10 +338,6 @@ ruleTester.run('role-supports-aria-props', rule, { code: '', errors: [getErrorMessage('aria-checked', 'link')], }, - { - code: '', - errors: [getErrorMessage('aria-checked', 'link')], - }, { code: '', errors: [getErrorMessage('aria-checked', 'img')], @@ -482,10 +458,6 @@ ruleTester.run('role-supports-aria-props', rule, { code: '', errors: [getErrorMessage('aria-expanded', 'toolbar')], }, - { - code: '', - errors: [getErrorMessage('aria-invalid', 'link')], - }, { code: '', errors: [getErrorMessage('aria-invalid', 'link')], From d21a25e6a81d9e8903e394d595c6d7d5fe9c651d Mon Sep 17 00:00:00 2001 From: Kate Higa <16447748+khiga8@users.noreply.github.com> Date: Mon, 10 Jul 2023 13:46:35 -0400 Subject: [PATCH 05/19] body now maps to generic role - see https://www.w3.org/TR/html-aria/ and https://www.w3.org/TR/html-aam-1.0/ --- tests/role-supports-aria-props.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/role-supports-aria-props.js b/tests/role-supports-aria-props.js index a7658712..fd2bc2dc 100644 --- a/tests/role-supports-aria-props.js +++ b/tests/role-supports-aria-props.js @@ -372,7 +372,7 @@ ruleTester.run('role-supports-aria-props', rule, { }, { code: '