summaryrefslogtreecommitdiff
path: root/source/features/hide-navigation-hover-highlight.tsx
blob: 20f2ce5760d188f394f2e27b21dd992a57ecc7cf (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
/*
Some lists like notifications, file lists, and issue lists,
are highlighted as you move the mouse over them. This highlight
is useful when navigating via the keyboard (j/k), but annoying
when just moving the mouse around.

This feature will hide the highlight until the first keyboard
navigation, then it will be displayed until the next full reload.
*/
import features from '../libs/features';

const className = 'rgh-no-navigation-highlight';

function init(): void {
	document.body.classList.add(className);
	document.body.addEventListener('navigation:keydown', () => {
		document.body.classList.remove(className);
	}, {once: true});
}

features.add({
	id: 'hide-navigation-hover-highlight',
	init
});