-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdemo.html
42 lines (37 loc) · 1.32 KB
/
demo.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
<head>
<meta charset="utf-8" />
<title>Modals and Keyboard Traps</title>
<meta name="description" content="Fixing tabindex" />
<!-- Mobile -->
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="main.css" />
</head>
<body>
<button class="modal-toggle">Open Modal</button>
<div class="modal">
<h1>Test modal:</h1>
<p>
Try hitting the <code>Tab</code> key a few times. It should loop back to
the first focusable item in the modal, instead of going into the
background outside of the modal. You can also try hitting
<code>Shift</code> + <code>Tab</code> a few times.
</p>
<div class="field">
<label for="fullname">Full Name</label>
<input id="fullname" type="text" />
</div>
<div class="field">
<label for="email">E-Mail Address</label>
<input id="email" type="text" />
</div>
<button id="signup">Sign me up already!</button>
</div>
<div class="modal-overlay"></div>
<script src="modal-demo.js"></script>
<script
src="https://cdn.jsdelivr.net/gh/hchiam/[email protected]/keyboard-focus-trap.js"
integrity="sha384-5PnYzry1hKZM375/B2mrZCP6CiJ5rt7ed+J5B3t0U/MZ2NjRU2S/O7bKhNwF06hX"
crossorigin="anonymous"
></script>
<script src="keyboard-focus-trap.js"></script>
</body>