From 637bf6c58c3e62877511687d8a6046f8aee63f03 Mon Sep 17 00:00:00 2001 From: Wilco Fiers Date: Tue, 1 Aug 2023 16:14:50 +0200 Subject: [PATCH] fix: add element semantics (#4115) --- lib/commons/standards/implicit-html-roles.js | 1 + lib/standards/html-elms.js | 4 ++++ test/integration/rules/aria-allowed-attr/passes.html | 2 ++ test/integration/rules/aria-allowed-attr/passes.json | 3 ++- .../rules/aria-allowed-role/aria-allowed-role.html | 2 ++ .../rules/aria-allowed-role/aria-allowed-role.json | 3 ++- 6 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/commons/standards/implicit-html-roles.js b/lib/commons/standards/implicit-html-roles.js index cc3c8edb74..64455b1cb2 100644 --- a/lib/commons/standards/implicit-html-roles.js +++ b/lib/commons/standards/implicit-html-roles.js @@ -157,6 +157,7 @@ const implicitHtmlRoles = { option: 'option', output: 'status', progress: 'progressbar', + search: 'search', section: vNode => { return hasAccessibleName(vNode) ? 'region' : null; }, diff --git a/lib/standards/html-elms.js b/lib/standards/html-elms.js index 4bfa346506..ce773e111c 100644 --- a/lib/standards/html-elms.js +++ b/lib/standards/html-elms.js @@ -749,6 +749,10 @@ const htmlElms = { allowedRoles: false, noAriaAttrs: true }, + search: { + contentTypes: ['flow'], + allowedRoles: ['form', 'group', 'none', 'presentation', 'region', 'search'] + }, section: { contentTypes: ['sectioning', 'flow'], allowedRoles: [ diff --git a/test/integration/rules/aria-allowed-attr/passes.html b/test/integration/rules/aria-allowed-attr/passes.html index 3d0b949dae..1812f63cdc 100644 --- a/test/integration/rules/aria-allowed-attr/passes.html +++ b/test/integration/rules/aria-allowed-attr/passes.html @@ -2156,3 +2156,5 @@ + + diff --git a/test/integration/rules/aria-allowed-attr/passes.json b/test/integration/rules/aria-allowed-attr/passes.json index 51ecaf0c2f..aa13ff6f71 100644 --- a/test/integration/rules/aria-allowed-attr/passes.json +++ b/test/integration/rules/aria-allowed-attr/passes.json @@ -101,6 +101,7 @@ ["#pass96"], ["#pass97"], ["#pass98"], - ["#pass99"] + ["#pass99"], + ["#pass100"] ] } diff --git a/test/integration/rules/aria-allowed-role/aria-allowed-role.html b/test/integration/rules/aria-allowed-role/aria-allowed-role.html index 6700ff1d71..3a2b99efad 100644 --- a/test/integration/rules/aria-allowed-role/aria-allowed-role.html +++ b/test/integration/rules/aria-allowed-role/aria-allowed-role.html @@ -301,3 +301,5 @@

ok

/> + + diff --git a/test/integration/rules/aria-allowed-role/aria-allowed-role.json b/test/integration/rules/aria-allowed-role/aria-allowed-role.json index 91d579fd04..e8b7e83a4a 100644 --- a/test/integration/rules/aria-allowed-role/aria-allowed-role.json +++ b/test/integration/rules/aria-allowed-role/aria-allowed-role.json @@ -87,7 +87,8 @@ ["#pass-imgmap-1"], ["#pass-imgmap-2"], ["#pass-navnone-1"], - ["#pass-navnone-2"] + ["#pass-navnone-2"], + ["#pass-search-elm"] ], "violations": [ ["#fail-dd-no-role"],