[autocomplete] allow keyboard to override an idle mouse
This commit is contained in:
@@ -101,8 +101,14 @@ function renderCompletions(element) {
|
|||||||
li.className = 'selected';
|
li.className = 'selected';
|
||||||
}
|
}
|
||||||
// on hover, select the completion
|
// on hover, select the completion
|
||||||
li.addEventListener('mouseover', () => {
|
// (use mousemove rather than mouseover, because
|
||||||
highlightCompletion(element, i);
|
// 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
|
// on click, set the completion
|
||||||
// (mousedown is used instead of click because click is
|
// (mousedown is used instead of click because click is
|
||||||
|
Reference in New Issue
Block a user