Open popups should block all default hotkeys - Fixes #2570

298baed59f0445ed2cf57842fba64659a24b2de2

Wolfsblvt <wolfsblvt@gmail.com>

1 files changed, +5 -4Ignore whitespace
public/scripts/RossAscends-mods.js+5 -4
@@ -954,6 +954,11 @@ export function initRossMods() {
954 * @param {KeyboardEvent} event954 * @param {KeyboardEvent} event
955 */955 */
956 async function processHotkeys(event) {956 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
957 //Enter to send when send_textarea in focus962 //Enter to send when send_textarea in focus
958 if (document.activeElement == hotkeyTargets['send_textarea']) {963 if (document.activeElement == hotkeyTargets['send_textarea']) {
959 const sendOnEnter = shouldSendOnEnter();964 const sendOnEnter = shouldSendOnEnter();
@@ -1107,10 +1112,6 @@ export function initRossMods() {
1107 }1112 }
11081113
1109 if (event.key == 'Escape') { //closes various panels1114 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
1114 //dont override Escape hotkey functions from script.js1115 //dont override Escape hotkey functions from script.js
1115 //"close edit box" and "cancel stream generation".1116 //"close edit box" and "cancel stream generation".
1116 if ($('#curEditTextarea').is(':visible') || $('#mes_stop').is(':visible')) {1117 if ($('#curEditTextarea').is(':visible') || $('#mes_stop').is(':visible')) {