Merge pull request #2677 from SillyTavern/popups-suppress-default-hotkeys Open popups should block all default hotkeys

86af35afdd9346857b61e9891a8ace9144d4fdee

Cohee <18619528+Cohee1207@users.noreply.github.com>

Signed
1 files changed, +5 -4Showing whitespace changes
public/scripts/RossAscends-mods.js+5 -4
@@ -954,6 +954,11 @@ export function initRossMods() {
954954 * @param {KeyboardEvent} event
955955 */
956956 async function processHotkeys(event) {
957+ // Default hotkeys and shortcuts shouldn't work if any popup is currently open
958+ if (Popup.util.isPopupOpen()) {
959+ return;
960+ }
961+
957962 //Enter to send when send_textarea in focus
958963 if (document.activeElement == hotkeyTargets['send_textarea']) {
959964 const sendOnEnter = shouldSendOnEnter();
@@ -1107,10 +1112,6 @@ export function initRossMods() {
11071112 }
11081113
11091114 if (event.key == 'Escape') { //closes various panels
1110- // Do not close panels if we are currently inside a popup
1111- if (Popup.util.isPopupOpen())
1112- return;
1113-
11141115 //dont override Escape hotkey functions from script.js
11151116 //"close edit box" and "cancel stream generation".
11161117 if ($('#curEditTextarea').is(':visible') || $('#mes_stop').is(':visible')) {