Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d2c852d
Add references.csv
IsaDC Aug 25, 2025
75b2188
Update values in references.csv
IsaDC Aug 25, 2025
7d1c89e
Update reference value in references.csv
IsaDC Aug 25, 2025
81b2f9b
Add example
IsaDC Aug 25, 2025
756b357
Trim example and add direction links
IsaDC Aug 25, 2025
4526c4f
Add test plan
IsaDC Aug 25, 2025
3b64677
Update references values and assertion mapping
IsaDC Aug 25, 2025
96f0f15
Remove blank spaces from assertions.csv
IsaDC Aug 25, 2025
6dbb21b
Update instrunctions to match switch name in tests.csv
IsaDC Aug 25, 2025
31cefb4
Update JAWS and VoiceOver commands for navigating forwards to a switc…
IsaDC Aug 25, 2025
3548d77
Update link text for the example in references.csv
IsaDC Aug 25, 2025
d72258c
Generate .html source files with scripts automatically
IsaDC Aug 25, 2025
94e122a
Revise link text for HTML label reference
mcking65 Aug 31, 2025
d2c5a75
Correct `setupScripts` to set `switch` to `checked`
IsaDC Sep 16, 2025
dbc7f6e
Generate .html source files with scripts automatically
IsaDC Sep 16, 2025
8a763be
Remove b and shift+b from commands
IsaDC Sep 16, 2025
c1129f5
Merge branch 'tests/switch-checkbox' of https://github.com/w3c/aria-a…
IsaDC Sep 16, 2025
b1d8eb6
Remove `aria-check` from references.csv and assertions.csv
IsaDC Sep 16, 2025
e1b13a4
Merge branch 'master' into tests/switch-checkbox
IsaDC Oct 6, 2025
f0c39dc
add the `checked HTML attribute` to references.csv and assertions.csv
IsaDC Oct 6, 2025
19e22ee
Merge branch 'master' into tests/switch-checkbox
IsaDC Oct 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions tests/switch-checkbox/data/assertions.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
assertionId,priority,assertionStatement,assertionPhrase,refIds
nameReducedMotion,1,Name 'Reduced motion ' is conveyed,convey name 'Reduced motion',inputTypeCheckbox label
roleSwitch,1,Role 'switch' is conveyed,convey role 'switch',switch inputTypeCheckbox
stateChangeToOff,1,"Change in state, to 'off', is conveyed","convey change in state, to 'off'",aria-checked
stateChangeToOn,1,"Change in state, to 'on', is conveyed","convey change in state, to 'on'",aria-checked
stateOff,1,State 'off' is conveyed,convey state 'off',aria-checked
stateOn,1,State 'on' is conveyed,convey state 'on',aria-checked
37 changes: 37 additions & 0 deletions tests/switch-checkbox/data/jaws-commands.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
testId,command,settings,assertionExceptions,presentationNumber
navForwardsToSwitchOffState,b,virtualCursor,,1
navForwardsToSwitchOffState,f,virtualCursor,,1.1
navForwardsToSwitchOffState,down down,virtualCursor,,1.2
navForwardsToSwitchOffState,tab,virtualCursor,,1.3
navForwardsToSwitchOffState,tab,pcCursor,,2
navBackToSwitchOffState,shift+b,virtualCursor,,4
navBackToSwitchOffState,shift+f,virtualCursor,,4.1
navBackToSwitchOffState,up,virtualCursor,,4.2
navBackToSwitchOffState,shift+tab,virtualCursor,,4.3
navBackToSwitchOffState,shift+tab,pcCursor,,5
navForwardsToSwitchOnState,b,virtualCursor,,7
navForwardsToSwitchOnState,f,virtualCursor,,7.1
navForwardsToSwitchOnState,down down,virtualCursor,,7.2
navForwardsToSwitchOnState,tab,virtualCursor,,7.3
navForwardsToSwitchOnState,tab,pcCursor,,8
navBackToSwitchOnState,shift+b,virtualCursor,,10
navBackToSwitchOnState,shift+f,virtualCursor,,10.1
navBackToSwitchOnState,up,virtualCursor,,10.2
navBackToSwitchOnState,shift+tab,virtualCursor,,10.3
navBackToSwitchOnState,shift+tab,pcCursor,,11
reqInfoAboutSwitchOffState,ins+tab,virtualCursor,,13
reqInfoAboutSwitchOffState,ins+up,virtualCursor,,13.1
reqInfoAboutSwitchOffState,ins+tab,pcCursor,,14
reqInfoAboutSwitchOffState,ins+up,pcCursor,,14.1
reqInfoAboutSwitchOnState,ins+tab,virtualCursor,,16
reqInfoAboutSwitchOnState,ins+up,virtualCursor,,16.1
reqInfoAboutSwitchOnState,ins+tab,pcCursor,,17
reqInfoAboutSwitchOnState,ins+up,pcCursor,,17.1
operateSwitchOffState,space,virtualCursor,,19
operateSwitchOffState,enter,virtualCursor,,19.1
operateSwitchOffState,space,pcCursor,,20
operateSwitchOffState,enter,pcCursor,,20.1
operateSwitchOnState,space,virtualCursor,,22
operateSwitchOnState,enter,virtualCursor,,22.1
operateSwitchOnState,space,pcCursor,,23
operateSwitchOnState,enter,pcCursor,,23.1
3 changes: 3 additions & 0 deletions tests/switch-checkbox/data/js/setFocusAfterAndTurnOnSwitch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// sets focus on a link after the switch, and sets the switch state to 'on'
testPageDocument.querySelector('[role="switch"]').setAttribute('aria-checked', 'true');
testPageDocument.getElementById('afterlink').focus();
2 changes: 2 additions & 0 deletions tests/switch-checkbox/data/js/setFocusAfterSwitch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// sets focus on a link after the switch
testPageDocument.getElementById('afterlink').focus();
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// sets focus on a link before the switch, and sets the state of the switch to 'on'
testPageDocument.querySelector('[role="switch"]').setAttribute('aria-checked', 'true');
testPageDocument.getElementById('beforelink').focus();
2 changes: 2 additions & 0 deletions tests/switch-checkbox/data/js/setFocusBeforeSwitch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// sets focus on a link before the switch
testPageDocument.getElementById('beforelink').focus();
3 changes: 3 additions & 0 deletions tests/switch-checkbox/data/js/setFocusOnAndTurnOnSwitch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// sets focus on the 'Notifications' switch, and sets its state to 'on'
testPageDocument.querySelector('[role="switch"]').setAttribute('aria-checked', 'true');
testPageDocument.querySelector('[role="switch"]').focus();
2 changes: 2 additions & 0 deletions tests/switch-checkbox/data/js/setFocusOnSwitch.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// sets focus on the 'Notifications' switch
testPageDocument.querySelector('[role="switch"]').focus();
37 changes: 37 additions & 0 deletions tests/switch-checkbox/data/nvda-commands.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
testId,command,settings,assertionExceptions,presentationNumber
navForwardsToSwitchOffState,b,browseMode,,1
navForwardsToSwitchOffState,f,browseMode,,1.1
navForwardsToSwitchOffState,down,browseMode,,1.2
navForwardsToSwitchOffState,tab,browseMode,,1.3
navForwardsToSwitchOffState,tab,focusMode,,2
navBackToSwitchOffState,shift+b,browseMode,,4
navBackToSwitchOffState,shift+f,browseMode,,4.1
navBackToSwitchOffState,up,browseMode,,4.2
navBackToSwitchOffState,shift+tab,browseMode,,4.3
navBackToSwitchOffState,shift+tab,focusMode,,5
navForwardsToSwitchOnState,b,browseMode,,7
navForwardsToSwitchOnState,f,browseMode,,7.1
navForwardsToSwitchOnState,down,browseMode,,7.2
navForwardsToSwitchOnState,tab,browseMode,,7.3
navForwardsToSwitchOnState,tab,focusMode,,8
navBackToSwitchOnState,shift+f,browseMode,,10.1
navBackToSwitchOnState,shift+b,browseMode,,10
navBackToSwitchOnState,up,browseMode,,10.2
navBackToSwitchOnState,shift+tab,browseMode,,10.3
navBackToSwitchOnState,shift+tab,focusMode,,11
reqInfoAboutSwitchOffState,ins+tab,browseMode,,13
reqInfoAboutSwitchOffState,ins+up,browseMode,,13.1
reqInfoAboutSwitchOffState,ins+tab,focusMode,,14
reqInfoAboutSwitchOffState,ins+up,focusMode,,14.1
reqInfoAboutSwitchOnState,ins+tab,browseMode,,16
reqInfoAboutSwitchOnState,ins+up,browseMode,,16.1
reqInfoAboutSwitchOnState,ins+tab,focusMode,,17
reqInfoAboutSwitchOnState,ins+up,focusMode,,17.1
operateSwitchOffState,space,browseMode,,19
operateSwitchOffState,enter,browseMode,,19.1
operateSwitchOffState,space,focusMode,,20
operateSwitchOffState,enter,focusMode,,20.1
operateSwitchOnState,space,browseMode,,22
operateSwitchOnState,enter,browseMode,,22.1
operateSwitchOnState,space,focusMode,,23
operateSwitchOnState,enter,focusMode,,23.1
11 changes: 11 additions & 0 deletions tests/switch-checkbox/data/references.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
refId,type,value,linkText
author,metadata,Isabel Del Castillo,
authorEmail,metadata,[email protected],
title,metadata,Switch Example Using HTML Checkbox Input,
reference,metadata,reference/2025-8-25_124251/switch-checkbox.html,Test Case Page for Switch Example
designPattern,metadata,https://www.w3.org/WAI/ARIA/apg/patterns/switch/,APG Pattern: Switch
example,metadata,https://www.w3.org/WAI/ARIA/apg/patterns/switch/examples/switch-checkbox/,APG Example: Switch Using HTML Checkbox Input
aria-checked,aria,aria-checked,aria-checked
switch,aria,switch,switch
inputTypeCheckbox,htmlAam,inputTypeCheckbox,inputTypeCheckbox
label,htmlAam,label,HTML label
7 changes: 7 additions & 0 deletions tests/switch-checkbox/data/scripts.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
setupScript,setupScriptDescription
setFocusAfterAndTurnOnSwitch,"sets focus on a link after the switch, and sets the switch state to 'on'"
setFocusAfterSwitch,sets focus on a link after the switch
setFocusBeforeAndTurnOnSwitch,"sets focus on a link before the switch, and sets the state of the switch to 'on'"
setFocusBeforeSwitch,sets focus on a link before the switch
setFocusOnAndTurnOnSwitch,"sets focus on the 'Notifications' switch, and sets its state to 'on'"
setFocusOnSwitch,sets focus on the 'Notifications' switch
9 changes: 9 additions & 0 deletions tests/switch-checkbox/data/tests.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
testId,title,presentationNumber,setupScript,instructions,assertions
navForwardsToSwitchOffState,Navigate forwards to a switch that is off,3,setFocusBeforeSwitch,"Starting at the 'Navigate forwards from here' link, navigate to the 'Reduced motion' switch.",roleSwitch nameReducedMotion stateOff
navBackToSwitchOffState,Navigate backwards to a switch that is off,6,setFocusAfterSwitch,"Starting at the 'Navigate backwards from here' link, navigate to the 'Reduced motion' switch.",roleSwitch nameReducedMotion stateOff
navForwardsToSwitchOnState,Navigate forwards to a switch that is on,9,setFocusBeforeAndTurnOnSwitch,"Starting at the 'Navigate forwards from here' link, navigate to the 'Reduced motion' switch.",roleSwitch nameReducedMotion stateOn
navBackToSwitchOnState,Navigate backwards to a switch that is on,12,setFocusAfterAndTurnOnSwitch,"Starting at the 'Navigate backwards from here' link, navigate to the 'Reduced motion' switch.",roleSwitch nameReducedMotion stateOn
reqInfoAboutSwitchOffState,Request information about a switch that is off,15,setFocusOnSwitch,"Starting at the 'Reduced motion' switch, read information about the switch.",roleSwitch nameReducedMotion stateOff
reqInfoAboutSwitchOnState,Request information about a switch that is on,18,setFocusOnAndTurnOnSwitch,"Starting at the 'Reduced motion' switch, read information about the switch.",roleSwitch nameReducedMotion stateOn
operateSwitchOffState,Operate a switch that is off,21,setFocusOnSwitch,"Starting at the 'Reduced motion' switch, change its state to 'on'.",stateChangeToOn
operateSwitchOnState,Operate a switch that is on,24,setFocusOnAndTurnOnSwitch,"Starting at the 'Reduced motion' switch, change its state to 'off'.",stateChangeToOff
27 changes: 27 additions & 0 deletions tests/switch-checkbox/data/voiceover_macos-commands.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
testId,command,settings,assertionExceptions,presentationNumber
navForwardsToSwitchOffState,ctrl+opt+right ctrl+opt+right,,,3
navForwardsToSwitchOffState,tab,,,3.1
navForwardsToSwitchOffState,j,singleQuickKeyNavOn,,3.2
navForwardsToSwitchOffState,b,singleQuickKeyNavOn,,3.3
navBackToSwitchOffState,ctrl+opt+left,,,6
navBackToSwitchOffState,shift+tab,,,6.1
navBackToSwitchOffState,shift+j,singleQuickKeyNavOn,,6.2
navBackToSwitchOffState,shift+b,singleQuickKeyNavOn,,6.3
navForwardsToSwitchOnState,ctrl+opt+right ctrl+opt+right,,,9
navForwardsToSwitchOnState,tab,,,9.1
navForwardsToSwitchOnState,j,singleQuickKeyNavOn,,9.2
navForwardsToSwitchOnState,b,singleQuickKeyNavOn,,9.3
navBackToSwitchOnState,ctrl+opt+left,,,12
navBackToSwitchOnState,shift+tab,,,12.1
navBackToSwitchOnState,shift+j,singleQuickKeyNavOn,,12.2
navBackToSwitchOnState,shift+b,singleQuickKeyNavOn,,12.3
reqInfoAboutSwitchOffState,ctrl+opt+f3,,,15
reqInfoAboutSwitchOffState,ctrl+opt+f4,,,15.1
reqInfoAboutSwitchOnState,ctrl+opt+f3,,,18
reqInfoAboutSwitchOnState,ctrl+opt+f4,,,18.1
operateSwitchOffState,ctrl+opt+space,,,21
operateSwitchOffState,space,,,21.1
operateSwitchOffState,enter,,,21.2
operateSwitchOnState,ctrl+opt+space,,,24
operateSwitchOnState,space,,,24.1
operateSwitchOnState,enter,,,24.2
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
button[role="switch"] {
display: block;
margin: 2px;
padding: 4px 4px 8px 8px;
border: 0 solid #005a9c;
border-radius: 5px;
width: 17em;
height: 3em;
text-align: left;
background-color: white;
color: black;
}

button[role="switch"] .label {
position: relative;
top: -3px;
display: inline-block;
padding: 0;
margin: 0;
width: 10em;
vertical-align: middle;
color: black;
}

button[role="switch"] svg {
display: inline-block;
width: 36px;
height: 20px;
forced-color-adjust: auto;
position: relative;
top: 4px;
}

button[role="switch"] svg rect {
fill-opacity: 0;
stroke-width: 2;
stroke: currentcolor;
}

button[role="switch"] svg rect.off {
display: block;
stroke: currentcolor;
fill: currentcolor;
fill-opacity: 1;
}

button[role="switch"][aria-checked="true"] svg rect.off {
display: none;
}

button[role="switch"] svg rect.on {
display: none;
}

button[role="switch"][aria-checked="true"] svg rect.on {
color: green;
display: block;
stroke-color: currentcolor;
fill: currentcolor;
fill-opacity: 1;
}

button[role="switch"] span.off {
display: inline-block;
}

button[role="switch"] span.on {
display: none;
}

button[role="switch"][aria-checked="true"] span.off {
display: none;
}

button[role="switch"][aria-checked="true"] span.on {
display: inline-block;
}

button[role="switch"]:focus,
button[role="switch"]:hover {
padding: 2px 2px 6px 6px;
border-width: 2px;
outline: none;
background-color: #def;
cursor: pointer;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
fieldset {
width: 22em;
}

legend {
font-size: 110%;
}

label {
display: block;
margin: 0.5em;
padding: 4px 4px 6px 6px;
border: 0 solid #005a9c;
border-radius: 5px;
width: 16em;
}

label .label {
display: inline-block;
width: 9em;
user-select: none;
}

label input[role="switch"] {
opacity: 0;
}

label input[role="switch"] ~ .state {
display: inline-block;
user-select: none;
}

label input[role="switch"] ~ .state > .container {
position: relative;
top: 2px;
display: inline-block;
border: 2px solid black;
width: 40px;
height: 20px;
border-radius: 11px;
}

label input[role="switch"] ~ .state > .container > .position {
position: relative;
top: 1px;
left: 2px;
display: inline-block;
border: 2px solid black;
border-radius: 9px;
width: 14px;
height: 14px;
background: black;
opacity: 0.6;
}

label input[role="switch"]:not(:checked) ~ .state span.on {
display: none;
}

label input[role="switch"]:checked ~ .state > span.off {
display: none;
}

label input[role="switch"]:checked ~ .state > .container > .position {
left: 20px;
border-color: green;
background: green;
opacity: 1;
}

label.focus,
label:hover {
padding: 2px 2px 4px 4px;
border-width: 2px;
outline: none;
background-color: #def;
cursor: pointer;
}

label.focus span.container,
label:hover span.container {
background-color: white;
}
Loading
Loading