From bd2a77a0f38e4f82fe0a8f437b8d038ae7188dfa Mon Sep 17 00:00:00 2001 From: 0neGal Date: Fri, 20 Dec 2024 22:19:57 +0100 Subject: properly open ` + // + // they require special handling, as unless the Enter key is + // pressed, then the menu won't open, and instead the element is + // focused, which isn't great + // + // so we make the main process send a fake Enter key press + if (active.closest("select")) { + active = active.closest("select"); + + // make sure `` + if (active_el.closest("select")) { + return; + } + // add `active_el` to `last_popup_selections` if we opened a popup if (e.new_state) { last_popup_selections.push({ diff --git a/src/app/js/settings.js b/src/app/js/settings.js index b5ef773..56bfc5f 100644 --- a/src/app/js/settings.js +++ b/src/app/js/settings.js @@ -264,6 +264,13 @@ settings.popup.load = () => { } } + let selects = document.querySelectorAll("#options select"); + for (let el of selects) { + el.addEventListener("change", () => { + el.blur(); + }) + } + // create Fuse based on options from `get_search_arr()` settings_fuse = new Fuse(get_search_arr(), { keys: ["text"], diff --git a/src/modules/ipc.js b/src/modules/ipc.js index 55737b7..57820b5 100644 --- a/src/modules/ipc.js +++ b/src/modules/ipc.js @@ -30,3 +30,10 @@ ipcMain.on("relaunch", () => { app.exit(0); }) + +ipcMain.on("send-enter-key", (e, coords) => { + e.sender.sendInputEvent({ + type: "char", + keyCode: "enter" + }) +}) -- cgit v1.2.3