blob: e8e0293e77bd28aba469bccffcb8d6c4245a7691 (
plain)
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
<!DOCTYPE html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="resources/shadow-dom.js"></script>
<script src="resources/focus-utils.js"></script>
<p>Tests for moving focus by pressing tab key across shadow boundaries.<br>
To manually test, press tab key six times then shift+tab seven times.<br>
It should traverse focusable elements in the increasing numerical order and then in the reverse order.</p>
<div id='host'>
<div slot='slot5' id='i2' tabindex=4>2. Assigned to slot5 whose tabindex is 2.</div>
<template data-mode='open'>
<slot name='slot1'>
x. The default tabindex for a slot node is set to 0.
<div id='i5' tabindex=0>5. The parent slot node's tabindex is 0. Second.</div>
<div id='i4' tabindex=2>4. The parent slot node's tabindex is 0. First.</div>
</slot>
<slot name='slot2' id='x1' tabindex=3>
x. The tabindex is 3. The slot node should be ignored.
<div id='i3' tabindex=10>3. The parent slot node's tabindex is 3. The slot node's tabindex matters. This element's tabindex comes after.</div>
</slot>
<slot name='slot3' id='x2' tabindex=0>
x. The tabindex is 0. The slot node should be ignored. If there is another slot node in same tabindex, the younger child comes first.
<div id='i6' tabindex=1>6. The parent slot node's tabindex is 0. First.</div>
<div id='i7' tabindex=1>7. The parent slot node's tabindex is 0. Second.</div>
</slot>
<slot name='slot4' id='x3' tabindex=1>
x. The tabindex is 1. The slot node should be ignored.
<div id='i1' tabindex=5>1. The slot node tabindex is 1.</div>
</slot>
<slot name='slot5' id='x5' tabindex=2>
x. The tabindex is 2. The slot node should be ignored. The host child is assigned to this slot node.
<div id='-' tabindex=1>-. The host child is assigned to the parent slot node. This text shouldn't apeare.</div>
</slot>
<slot name='slot6' id='x6' tabindex=5>
x. The tabindex is 5. The slot node should be ignored.
<div id='x6' tabindex=-1>x. tabindex is -1. Should be skipped.</div>
</slot>
<slot name='slot7' id='x7' tabindex=-1>
x. tabindex is -1. Should be skipped.
<div id='x8' tabindex=1>x. The parent slot node is skipped.</div>
</slot>
</template>
</div>
<script>
promise_test(async () => {
convertTemplatesToShadowRootsWithin(host);
let elements = [
'host/i1',
'i2',
'host/i3',
'host/i4',
'host/i5',
'host/i6',
'host/i7'
];
await assert_focus_navigation_forward(elements);
elements.reverse();
await assert_focus_navigation_backward(elements);
}, 'Default tabindex for a slot node should be 0.');
</script>
|