* Handle keypress event * @param {KeyboardEvent} e Event
(e)
| 86 | * @param {KeyboardEvent} e Event |
| 87 | */ |
| 88 | function handleKeypress(e) { |
| 89 | if (e.key !== "Enter") return; |
| 90 | |
| 91 | e.preventDefault(); |
| 92 | e.stopPropagation(); |
| 93 | const activeHint = $ul.get(".active"); |
| 94 | if (!activeHint) return; |
| 95 | const value = activeHint.getAttribute("value"); |
| 96 | if (onSelect) onSelect(value); |
| 97 | else $input.value = value; |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * Handle keydown event |
nothing calls this directly
no test coverage detected