-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
66 lines (60 loc) · 1.8 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
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>react-visible-focus demo</title>
<style>
body {
background: steelblue;
font-family: Arial, Helvetica, sans-serif;
display: flex;
align-items: center;
justify-content: center;
margin: 0;
width: 100vw;
height: 100vh;
}
main {
background: white;
border-radius: 6px;
max-width: 500px;
padding: 0 20px;
}
#root {
text-align: center;
}
[data-focus-visible="false"] * {
outline: none;
}
</style>
</head>
<body>
<main>
<div id="root"></div>
<p>This component attempts to emulate the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/:focus-visible">:focus-visible pseudoselector</a> behavior using similar heuristics but does not follow the spec completely.
</p>
<p>
Focus styles are still displayed when focus is given to an input.
</p>
</main>
<script crossorigin src="https://unpkg.com/react@17/umd/react.development.js"></script>
<script crossorigin src="https://unpkg.com/react-dom@17/umd/react-dom.development.js"></script>
<script src="./dist/react-visible-focus.umd.js"></script>
<script>
"use strict";
const e = React.createElement;
const App = () => e(
ReactVisibleFocus,
null,
e('h1', null, 'react-visible-focus'),
e('h2', { tabIndex: '0' }, 'focusable subheader (click on me)'),
e('input', { type: 'text', placeholder: 'An input' }),
e('button', { type: 'button' }, 'A button')
);
ReactDOM.render(App(), document.querySelector("#root"));
</script>
</body>
</html>