Skip to content

Commit aa6f589

Browse files
Copilothaslinghuis
andcommitted
Add dialog.open check to prevent Enter key trigger when dialog is closed
Co-authored-by: haslinghuis <[email protected]>
1 parent c8f44bd commit aa6f589

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/js/gui.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -392,8 +392,8 @@ class GuiControl {
392392
// Add Enter key support for single-choice dialog
393393
$(document).off("keydown.informationDialog");
394394
$(document).on("keydown.informationDialog", (e) => {
395-
// Only trigger if Enter key is pressed and target is not an input/textarea
396-
if (e.which === 13 && !$(e.target).is("input, textarea")) {
395+
// Only trigger if Enter is pressed, dialog is open, and target is not an input/textarea
396+
if (e.which === 13 && dialog[0].open && !$(e.target).is("input, textarea")) {
397397
e.preventDefault();
398398
confirmAction();
399399
}

0 commit comments

Comments
 (0)