diff options
| author | Volpeon <git@volpeon.ink> | 2022-02-05 12:26:35 +0100 |
|---|---|---|
| committer | Volpeon <git@volpeon.ink> | 2022-02-05 12:26:35 +0100 |
| commit | 144b7a2ea83507c98544d14ad9435cc5e51ac071 (patch) | |
| tree | 7b18227482fa9f5d29d358ce1540b7a6d105febd /static | |
| parent | Init (diff) | |
| download | iro-design-144b7a2ea83507c98544d14ad9435cc5e51ac071.tar.gz iro-design-144b7a2ea83507c98544d14ad9435cc5e51ac071.tar.bz2 iro-design-144b7a2ea83507c98544d14ad9435cc5e51ac071.zip | |
Update
Diffstat (limited to 'static')
| -rw-r--r-- | static/script.js | 26 |
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 | |||
| 5 | document.querySelectorAll('.is-indeterminate').forEach(el => el.indeterminate = true); | ||
| 6 | |||
| 7 | // | ||
| 8 | |||
| 9 | const 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 | |||
| 19 | const disableFocusIndicator = e => { | ||
| 20 | document.body.classList.remove('t-keyboard'); | ||
| 21 | |||
| 22 | document.removeEventListener('mousedown', disableFocusIndicator); | ||
| 23 | document.addEventListener('keydown', enableFocusIndicator); | ||
| 24 | } | ||
| 25 | |||
| 26 | document.addEventListener('keydown', enableFocusIndicator); | ||
