summaryrefslogtreecommitdiffstats
path: root/static/script.js
blob: ece93e87f4a9fd3e14f2e6a3ca7f0e4718192f43 (plain) (blame)
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
'use strict';

//

document.querySelectorAll('.is-indeterminate').forEach(el => el.indeterminate = true);

//

const enableFocusIndicator = e => {
    if (e.key !== 'Tab') {
        return;
    }

    document.body.classList.add('t-keyboard');
    document.removeEventListener('keydown', enableFocusIndicator);
    document.addEventListener('mousedown', disableFocusIndicator);
}

const disableFocusIndicator = e => {
    document.body.classList.remove('t-keyboard');

    document.removeEventListener('mousedown', disableFocusIndicator);
    document.addEventListener('keydown', enableFocusIndicator);
}

document.addEventListener('keydown', enableFocusIndicator);