ctucx.git: trainsearch

web based trip-planner, fork of https://cyberchaos.dev/yuka/trainsearch

commit b465392356bf0747e56130d8f847bda28a976705
parent c523d4633c05a19950e638af656538fcd56a1f1c
Author: Katja (ctucx) <git@ctu.cx>
Date: Tue, 21 Jan 2025 20:53:24 +0100

searchView: fix jump to `to` when `via` is not unfolded
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/searchView.js b/src/searchView.js
@@ -347,10 +347,10 @@ export const setSuggestion = (data, inputId) => {
 
 	if (inputId === 'from') {
 		ElementById('fromSuggestions').classList.remove('mouseover');
+		ElementById('to').focus();
+
 		if (!ElementById('via').classList.contains('hidden')) {
 			ElementById('via').focus();
-		} else {
-			ElementById('to').focus();
 		}
 	} else if (inputId === 'via') {
 		ElementById('viaSuggestions').classList.remove('mouseover');

@@ -489,7 +489,7 @@ const onKeydown = (e) => {
 		return false;
 	}
 
-	if (which == 40) { // keydown
+	if (which == 40) { // keyup
 		if (!ElementById('selected')) {
 			document.querySelector(`#${e.target.id}Suggestions>.box>:first-child`).id = 'selected';
 		} else {