[autocomplete] allow enter to do the default thing
This commit is contained in:
parent
143ca4820e
commit
74889c4c94
1 changed files with 1 additions and 6 deletions
|
@ -232,16 +232,11 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||
event.preventDefault();
|
||||
highlightCompletion(element, element.selected_completion+1);
|
||||
}
|
||||
// if enter or right are pressed, add the selected completion
|
||||
// if enter or right are pressed while a completion is selected, add the selected completion
|
||||
else if((event.code === "Enter" || event.code == "ArrowRight") && element.selected_completion !== -1) {
|
||||
event.preventDefault();
|
||||
setCompletion(element, Object.keys(element.completions)[element.selected_completion]);
|
||||
}
|
||||
// If enter is pressed while nothing is selected, submit the form
|
||||
else if(event.code === "Enter" && element.selected_completion === -1) {
|
||||
event.preventDefault();
|
||||
element.form.submit();
|
||||
}
|
||||
// if escape is pressed, hide the completion block
|
||||
else if(event.code === "Escape") {
|
||||
event.preventDefault();
|
||||
|
|
Reference in a new issue