summaryrefslogtreecommitdiffstats
path: root/static
diff options
context:
space:
mode:
Diffstat (limited to 'static')
-rw-r--r--static/script.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/static/script.js b/static/script.js
new file mode 100644
index 0000000..ece93e8
--- /dev/null
+++ b/static/script.js
@@ -0,0 +1,26 @@
1'use strict';
2
3//
4
5document.querySelectorAll('.is-indeterminate').forEach(el => el.indeterminate = true);
6
7//
8
9const enableFocusIndicator = e => {
10 if (e.key !== 'Tab') {
11 return;
12 }
13
14 document.body.classList.add('t-keyboard');
15 document.removeEventListener('keydown', enableFocusIndicator);
16 document.addEventListener('mousedown', disableFocusIndicator);
17}
18
19const disableFocusIndicator = e => {
20 document.body.classList.remove('t-keyboard');
21
22 document.removeEventListener('mousedown', disableFocusIndicator);
23 document.addEventListener('keydown', enableFocusIndicator);
24}
25
26document.addEventListener('keydown', enableFocusIndicator);