Skip to content

Commit 041fe61

Browse files
Fixes for a1b64e, ebe86a due to surveys (#2209)
* Update a1b64e Pass 2 to add role * Add a support note for issue 1909 regarding cycle to browser * Add a passing modal example * Fix spacing * Fix spacing --------- Co-authored-by: Carlos Duarte <[email protected]>
1 parent d1b7a2a commit 041fe61

2 files changed

+52
-3
lines changed

_rules/focusable-no-keyboard-trap-non-standard-nav-ebe86a.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ For each target element focus can cycle to the browser UI by using the method ad
5151

5252
### Accessibility Support
5353

54-
There are no accessibility support issues known.
54+
Some browsers have settings that will immediately cycle focus back to the web document. This fulfills the expectation because focus can cycle to the browser UI and the browser UI cycles focus back to the web document.
5555

5656
### Bibliography
5757

_rules/focusable-no-keyboard-trap-standard-nav-a1b64e.md

+51-2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ acknowledgments:
1818
- Malin Øvrebø
1919
- Shadi Abou-Zahra
2020
- Stein Erik Skotkjerra
21+
- Tom Brunet
2122
funding:
2223
- WAI-Tools
2324
---
@@ -43,7 +44,7 @@ This rule only requires navigation in one direction (either forward or backward)
4344

4445
### Accessibility Support
4546

46-
There are no accessibility support issues known.
47+
Some browsers have settings that will immediately cycle focus back to the web document. This fulfills the expectation because focus can cycle to the browser UI and the browser UI cycles focus back to the web document.
4748

4849
### Bibliography
4950

@@ -68,7 +69,7 @@ These [focusable][] elements do not create a trap for keyboard navigation.
6869
This element is made [focusable][] by the `tabindex` attribute. It does not create a trap for keyboard navigation.
6970

7071
```html
71-
<div tabindex="1">Text</div>
72+
<div role="button" tabindex="1">Text</div>
7273
```
7374

7475
#### Passed Example 3
@@ -79,6 +80,54 @@ This element is made [focusable][] by the `tabindex` attribute, even if it is no
7980
<div tabindex="-1">Text</div>
8081
```
8182

83+
#### Passed Example 4
84+
85+
While the elements with id "sentinelBefore" and "sentinelAfter" contain focus to the contents of the div with name "Sample Modal", focus is not trapped since the user can
86+
use [standard keyboard navigation](#standard-keyboard-navigation) using the Escape key or by activating the "Close button" to dismiss the modal
87+
88+
```html
89+
<div>Main page content with <a href="#">some link</a></div>
90+
<div aria-hidden="true">
91+
<a href="#" id="sentinelBefore" style="position:absolute; top:-999em"
92+
>Upon receiving focus, this focus sentinel should wrap focus to the bottom of the modal</a
93+
>
94+
</div>
95+
<div
96+
id="sampleModal"
97+
role="dialog"
98+
aria-label="Sample Modal"
99+
aria-modal="true"
100+
style="border: solid black 1px; padding: 1rem;"
101+
>
102+
<label>First and last name <input id="dialogFirst"/></label><br />
103+
<button id="closeButton">Close button</button>
104+
</div>
105+
<div aria-hidden="true">
106+
<a href="#" id="sentinelAfter" style="position:absolute; top:-999em"
107+
>Upon receiving focus, this focus sentinel should wrap focus to the top of the modal</a
108+
>
109+
</div>
110+
<script>
111+
window.addEventListener('load', () => {
112+
document.getElementById('dialogFirst').focus();
113+
})
114+
document.getElementById('sentinelBefore').addEventListener('focus', () => {
115+
document.getElementById('closeButton').focus()
116+
})
117+
document.getElementById('sentinelAfter').addEventListener('focus', () => {
118+
document.getElementById('dialogFirst').focus()
119+
})
120+
document.getElementById('closeButton').addEventListener('click', () => {
121+
document.getElementById('sampleModal').style.display = 'none'
122+
})
123+
document.getElementById('sampleModal').addEventListener('keydown', (evt) => {
124+
if (evt.key === "Escape") {
125+
document.getElementById('sampleModal').style.display = 'none';
126+
}
127+
})
128+
</script>
129+
```
130+
82131
### Failed
83132

84133
#### Failed Example 1

0 commit comments

Comments
 (0)