Skip to content

Commit 0643cbd

Browse files
jeeyyyWilcoFiers
authored andcommitted
fix: role=radio should not require aria-checked (#1448)
* fix: role radio required state and props * test: add more integration tests * test: add tests to allowed attr
1 parent efaed91 commit 0643cbd

File tree

6 files changed

+23
-5
lines changed

6 files changed

+23
-5
lines changed

lib/commons/aria/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,9 +1550,9 @@ lookupTable.role = {
15501550
'aria-posinset',
15511551
'aria-setsize',
15521552
'aria-required',
1553-
'aria-errormessage'
1554-
],
1555-
required: ['aria-checked']
1553+
'aria-errormessage',
1554+
'aria-checked'
1555+
]
15561556
},
15571557
owned: null,
15581558
nameFrom: ['author', 'contents'],

test/checks/aria/allowed-attr.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ describe('aria-allowed-attr', function() {
109109
node.tabIndex = 1;
110110
node.setAttribute('role', 'radio');
111111
node.setAttribute('aria-required', 'true');
112+
node.setAttribute('aria-checked', 'true');
112113
fixture.appendChild(node);
113114

114115
assert.isTrue(

test/integration/rules/aria-allowed-attr/passes.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,6 @@
145145

146146
<button id="pass73" aria-roledescription="attachment button"></button>
147147
<input type="checkbox" aria-roledescription="cuisine type checkbox" id="pass74" />
148+
149+
<span role="radio" id="pass75" aria-checked="false">I am RED!</span>
150+
<span role="radio" id="pass76" aria-checked="true">I am GREEN!</span>

test/integration/rules/aria-allowed-attr/passes.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@
7676
["#pass71"],
7777
["#pass72"],
7878
["#pass73"],
79-
["#pass74"]
79+
["#pass74"],
80+
["#pass75"],
81+
["#pass76"]
8082
]
8183
}

test/integration/rules/aria-required-attr/required-attr.html

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
<div role="spinbutton" id="pass3" aria-valuenow="value" aria-valuemax="value" aria-valuemin="value">ok</div>
44
<div role="heading" id="pass4" aria-level="1">ok</div>
55
<div role="combobox" id="pass5" aria-expanded="true">ok</div>
6+
<span role="radio" id="pass6">I am BLUE!</span>
7+
<span role="radio" id="pass7" aria-checked="false">I am RED!</span>
8+
<span role="radio" id="pass8" aria-checked="true">I am GREEN!</span>
69

710
<div role="scrollbar" id="violation1">fail</div>
811
<div role="slider" id="violation2">fail</div>

test/integration/rules/aria-required-attr/required-attr.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,14 @@
88
["#violation4"],
99
["#violation5"]
1010
],
11-
"passes": [["#pass1"], ["#pass2"], ["#pass3"], ["#pass4"], ["#pass5"]]
11+
"passes": [
12+
["#pass1"],
13+
["#pass2"],
14+
["#pass3"],
15+
["#pass4"],
16+
["#pass5"],
17+
["#pass6"],
18+
["#pass7"],
19+
["#pass8"]
20+
]
1221
}

0 commit comments

Comments
 (0)