1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
content / test / data / accessibility / html / name-calc-focusable.html [blame]
<!DOCTYPE html>
<!--
@BLINK-ALLOW:focus*
@EXECUTE-AND-WAIT-FOR:setTabIndex0()
@EXECUTE-AND-WAIT-FOR:setTabIndexMinus1()
@EXECUTE-AND-WAIT-FOR:setFocus()
@EXECUTE-AND-WAIT-FOR:removeTabIndex()
-->
<div>
<p>Cats
<p>Dogs
</p>
<script>
const div = document.querySelector('div');
document.title = 'not-focusable-no-name';
function setTabIndex0() {
div.tabIndex = '0';
document.title = 'tabindex-0-has-name';
return 'tabindex-0-has-name';
}
function setTabIndexMinus1() {
div.tabIndex = '-1';
document.title = 'tabindex-minus-1-no-name';
return 'tabindex-minus-1-no-name';
}
function setFocus() {
div.focus();
document.title = 'focus-has-name';
return 'focus-has-name';
}
function removeTabIndex() {
div.removeAttribute('tabindex'); // This should also blur the element.
document.title = 'remove-tabindex-no-name';
return 'remove-tabindex-no-name';
}
</script>