From 53b1695627ca3a9750c8adf0c8bb2aec16d0ad89 Mon Sep 17 00:00:00 2001 From: somebody Date: Sun, 30 Oct 2022 21:32:47 -0500 Subject: [PATCH] Support auto-focusing in openPopup --- static/koboldai.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/static/koboldai.js b/static/koboldai.js index 9e413c2a..f6dbbdf0 100644 --- a/static/koboldai.js +++ b/static/koboldai.js @@ -4922,6 +4922,12 @@ function openPopup(id) { const popup = $el(`#${id}`); popup.classList.remove("hidden"); + + // Sometimes we want to instantly focus on certain elements when a menu opens. + for (const noticeMee of popup.getElementsByClassName("focus-on-me")) { + noticeMee.focus(); + break; + } } function closePopups() {