Moving cursor to input text when pressing on filter

This commit is contained in:
Wlowscha 2025-02-12 22:04:38 +01:00
parent fa5232a704
commit 1cbe24b8c7
No known key found for this signature in database
GPG Key ID: 3C8F1AD330565D04

View File

@ -115,6 +115,10 @@ export default class PokedexScanUiHandler extends FormModalUiHandler {
this.reduceKeys();
setTimeout(() => {
input.setFocus(); // Focus after a short delay to avoid unwanted input
}, 50);
input.on("keydown", (inputObject, evt: KeyboardEvent) => {
if ([ "escape", "space" ].some((v) => v === evt.key.toLowerCase() || v === evt.code.toLowerCase()) && ui.getMode() === Mode.AUTO_COMPLETE) {
// Delete autocomplete list and recovery focus.