From f0292714b94a1483f4148f3ca7206897cfb21318 Mon Sep 17 00:00:00 2001 From: Philip Jia Date: Tue, 7 Mar 2023 12:24:54 -0800 Subject: [PATCH] fix(focus-order-semantics): Add ARIA role article to list of valid roles for scrollable regions (#3927) * Pending changes exported from your codespace * Un-commenting article role * Adding rule test for focus-order-semantics --- .../aria/valid-scrollable-semantics-evaluate.js | 1 + test/checks/aria/valid-scrollable-semantics.js | 12 ++++++++++++ .../focus-order-semantics/focus-order-semantics.html | 1 + .../focus-order-semantics/focus-order-semantics.json | 3 ++- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/lib/checks/aria/valid-scrollable-semantics-evaluate.js b/lib/checks/aria/valid-scrollable-semantics-evaluate.js index 1eb53b6d7a..7c3615dbcc 100644 --- a/lib/checks/aria/valid-scrollable-semantics-evaluate.js +++ b/lib/checks/aria/valid-scrollable-semantics-evaluate.js @@ -17,6 +17,7 @@ const VALID_TAG_NAMES_FOR_SCROLLABLE_REGIONS = { */ const VALID_ROLES_FOR_SCROLLABLE_REGIONS = { application: true, + article: true, banner: false, complementary: true, contentinfo: true, diff --git a/test/checks/aria/valid-scrollable-semantics.js b/test/checks/aria/valid-scrollable-semantics.js index c4aca6578e..26ea72533a 100644 --- a/test/checks/aria/valid-scrollable-semantics.js +++ b/test/checks/aria/valid-scrollable-semantics.js @@ -106,6 +106,18 @@ describe('valid-scrollable-semantics', function () { ); }); + it('should return true for role=article', function () { + var node = document.createElement('div'); + node.setAttribute('role', 'article'); + fixture.appendChild(node); + flatTreeSetup(fixture); + assert.isTrue( + axe.testUtils + .getCheckEvaluate('valid-scrollable-semantics') + .call(checkContext, node) + ); + }); + it('should return true for nav elements', function () { var node = document.createElement('nav'); fixture.appendChild(node); diff --git a/test/integration/rules/focus-order-semantics/focus-order-semantics.html b/test/integration/rules/focus-order-semantics/focus-order-semantics.html index 3588fe1f95..7ac09790ae 100644 --- a/test/integration/rules/focus-order-semantics/focus-order-semantics.html +++ b/test/integration/rules/focus-order-semantics/focus-order-semantics.html @@ -30,6 +30,7 @@

Valid landmark roles for scrollable containers

+

Valid scrollable HTML tags for scrollable regions, not selected by this diff --git a/test/integration/rules/focus-order-semantics/focus-order-semantics.json b/test/integration/rules/focus-order-semantics/focus-order-semantics.json index c682ed88e4..dac1ba8f13 100644 --- a/test/integration/rules/focus-order-semantics/focus-order-semantics.json +++ b/test/integration/rules/focus-order-semantics/focus-order-semantics.json @@ -10,7 +10,8 @@ ["#pass6"], ["#pass7"], ["#pass8"], - ["#pass9"] + ["#pass9"], + ["#pass10"] ], "violations": [ ["#violation1"],