Skip to content

Commit

Permalink
fix: add <search> element semantics (#4115)
Browse files Browse the repository at this point in the history
  • Loading branch information
WilcoFiers committed Aug 1, 2023
1 parent c4c3e65 commit 637bf6c
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/commons/standards/implicit-html-roles.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@ const implicitHtmlRoles = {
option: 'option',
output: 'status',
progress: 'progressbar',
search: 'search',
section: vNode => {
return hasAccessibleName(vNode) ? 'region' : null;
},
Expand Down
4 changes: 4 additions & 0 deletions lib/standards/html-elms.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
Expand Down
2 changes: 2 additions & 0 deletions test/integration/rules/aria-allowed-attr/passes.html
Original file line number Diff line number Diff line change
Expand Up @@ -2156,3 +2156,5 @@

<input type="checkbox" aria-checked="false" id="pass98" />
<input type="checkbox" aria-checked="mixed" id="pass99" />

<search aria-expanded="true" id="pass100"></search>
3 changes: 2 additions & 1 deletion test/integration/rules/aria-allowed-attr/passes.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@
["#pass96"],
["#pass97"],
["#pass98"],
["#pass99"]
["#pass99"],
["#pass100"]
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -301,3 +301,5 @@ <h1 role="text" id="fail-text-1">ok</h1>
/>
<area shape="circle" coords="15,15,10" role="checkbox" id="fail-imgmap-2" />
</map>

<search role="form" id="pass-search-elm"></search>
Original file line number Diff line number Diff line change
Expand Up @@ -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"],
Expand Down

0 comments on commit 637bf6c

Please sign in to comment.