forked from nolanlawson/arrow-key-navigation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
144 lines (140 loc) · 3.42 KB
/
index.html
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>KaiOS arrow-key-navigation test app</title>
<style>
label, details, .block {
display: block;
margin: 10px;
}
</style>
</head>
<body>
<h1>KaiOS arrow-key-navigation test app</h1>
<details>
<summary>hey click me</summary>
<p>here is some more info</p>
</details>
<label>
URL
<input type=url value="foo.com">
</label>
<label>
Email
<input type=email value="[email protected]">
</label>
<label>
Number
<input type=number value="123">
</label>
<label>
Text
<input type=text value="foobar">
</label>
<label>
Search
<input type=search value="baz">
</label>
<label>
Password
<input type=password value="psst">
</label>
<label>
Tel
<input type=tel value="123">
</label>
<div class="block">
Content editable
<div contenteditable>Edit meeeee</div>
</div>
<div class="block">
<button type="button">Hello button</button>
</div>
<div class="block">
<label>Check!
<input type="checkbox">
</label>
</div>
<div class="block">
Radio!
<label>Radio 1
<input type="radio" name="radio" value="radio1">
</label>
<label>Radio 2
<input type="radio" name="radio" value="radio2">
</label>
</div>
<div>
<open-component></open-component>
</div>
<div>
<closed-component></closed-component>
</div>
<div>
<my-component-2></my-component-2>
</div>
<div>
<input type="text" value="hi">
</div>
<script>
class OpenComponent extends HTMLElement {
constructor() {
super()
this.attachShadow({ mode: 'open' })
this.shadowRoot.innerHTML = `
<h2>open shadow</h2>
<input type="text" value="one">
<input type="text" value="two">
<input type="text" value="three">
`
}
}
class ClosedComponent extends HTMLElement {
constructor() {
super()
const root = this.attachShadow({ mode: 'closed' })
root.innerHTML = `
<h2>closed shadow</h2>
<input type="text" value="one">
<input type="text" value="two">
<input type="text" value="three">
`
}
}
class Component2 extends HTMLElement {
constructor() {
super()
this.attachShadow({ mode: 'open'})
this.shadowRoot.innerHTML = `
<span>not focusable</span>
<my-component-3></my-component-3>
<span>not focusable</span>
`
this.classList.add('my-component-2')
}
}
class Component3 extends HTMLElement {
constructor() {
super()
this.attachShadow({ mode: 'open'})
this.shadowRoot.innerHTML = `
<span>not focusable</span>
<button class="inside-shadow-button">my button</button>
<span>not focusable</span>
`
this.classList.add('my-component-2')
}
}
customElements.define('my-component-2', Component2)
customElements.define('my-component-3', Component3)
customElements.define('open-component', OpenComponent)
customElements.define('closed-component', ClosedComponent)
</script>
<script src="pkg/dist-umd/index.js"></script>
<script>
arrowKeyNavigation.register()
</script>
</body>
</html>