[autocomplete] allow keyboard to override an idle mouse

This commit is contained in:
Shish 2023-12-29 11:39:00 +00:00
parent ef5f1f8599
commit 0e887175e0

View file

@ -101,8 +101,14 @@ function renderCompletions(element) {
li.className = 'selected';
}
// on hover, select the completion
li.addEventListener('mouseover', () => {
highlightCompletion(element, i);
// (use mousemove rather than mouseover, because
// if the mouse is stationary, then we want the
// keyboard to be able to override it)
li.addEventListener('mousemove', () => {
// avoid re-rendering if the completion is already selected
if(element.selected_completion !== i) {
highlightCompletion(element, i);
}
});
// on click, set the completion
// (mousedown is used instead of click because click is