forked from medialize/ally.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pointer-focus-children.example.html
68 lines (58 loc) · 1.58 KB
/
pointer-focus-children.example.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>ally.fix.pointerFocusChildren Example</title>
<link rel="jsbin" href="https://jsbin.com/gomofa/">
<style id="example-css">
body :focus {
outline: 3px solid red;
}
.flex {
display: -ms-flexbox;
display: flex;
width: 300px;
}
.flex > span {
-ms-flex: 1 1 10px;
flex: 1 1 10px;
display: block;
transition:
visibility 1s 0.5s linear,
background-color 1s 0s ease-in-out;
}
.flex > span:hover {
background-color: green;
}
.flex > span:active {
background-color: blue;
}
</style>
</head>
<body>
<article id="example-introduction">
<h1><code>ally.fix.pointerFocusChildren</code> Example</h1>
<p>There are two focusable div elements in this document, each containing two span element children layed out using FlexBox. The first div element exhibits the undesired behavior upon click, the second div element is covered by <code>ally.fix.pointerFocusChildren</code>.</p>
</article>
<div id="example-html">
<main>
<h2>Natural Browser Behavior</h2>
<div tabindex="-1" class="flex">
<span>one</span>
<span>two</span>
</div>
<h2>Fixed Behavior</h2>
<div tabindex="-1" id="fix-pointer-focus" class="flex">
<span>one</span>
<span>two</span>
</div>
</main>
</div>
<script src="https://cdn.jsdelivr.net/ally.js/1.1.0/ally.min.js"></script>
<script id="example-js">
ally.fix.pointerFocusChildren({
context: '#fix-pointer-focus',
});
</script>
</body>
</html>