Open popups should block all default hotkeys - Fixes #2570
| @@ -954,6 +954,11 @@ export function initRossMods() { | |||
| 954 | * @param {KeyboardEvent} event | 954 | * @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 focus | 962 | //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 | } |
| 1108 | 1113 | ||
| 1109 | if (event.key == 'Escape') { //closes various panels | 1114 | 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.js | 1115 | //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')) { |