ctucx.git: oeffisearch

[nimlang] fast and simple tripplanner

commit dd2694508416671aac650982f15d8e295be147bd
parent 31e3e8539a286b0b465c0d63e90791ba986744d5
Author: ctucx <leah@antifa.jetzt>
Date: Fri, 12 Jun 2020 19:55:29 +0000

i'm stupid
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/client/js/searchView.js b/client/js/searchView.js
@@ -29,11 +29,11 @@ const searchTemplate = (journeysHistory) => html`
 				<h1>Öffisearch</h1>
 			</div>
 			<label for="from">${t('from')}:</label>
-			<input type="text" name="from" id="from" placeholder="${t('from')}" value="${fromValue}" autocomplete="off" @focus=${startTyping} @blur=${stopTyping} @keydown=${onKeypress} required>
+			<input type="text" name="from" id="from" placeholder="${t('from')}" value="${fromValue}" autocomplete="off" @focus=${startTyping} @blur=${stopTyping} @keyup=${onKeyup} @keydown=${onKeydown} required>
 			<div class="suggestions" id="fromSuggestions"></div>
 
 			<label for="to">${t('to')}:</label>
-			<input type="text" name="to" id="to" placeholder="${t('to')}" value="${toValue}" autocomplete="off" @focus=${startTyping} @blur=${stopTyping} @keydown=${onKeypress} required>
+			<input type="text" name="to" id="to" placeholder="${t('to')}" value="${toValue}" autocomplete="off" @focus=${startTyping} @blur=${stopTyping} @keyup=${onKeyup} @keydown=${onKeydown} required>
 			<div class="suggestions" id="toSuggestions"></div>
 
 			<div class="row">

@@ -410,7 +410,7 @@ const stopMouseOverSuggestions = (e) => {
 	el.classList.remove('mouseover');
 };
 
-const onKeypress = (e) => {
+const onKeyup = (e) => {
 	let which = e.which || e.keyCode;
 
 	let forbiddeKeys = [13, 38, 40];

@@ -418,6 +418,11 @@ const onKeypress = (e) => {
 	if (!forbiddeKeys.includes(which)) {
 		loadSuggestions(e, e.target.id);
 	}
+};
+
+
+const onKeydown = (e) => {
+	let which = e.which || e.keyCode;
 
 	if (which == 13) { // enter
 		if (!ElementById('selected')) {