Skip to content

Commit 50abdb4

Browse files
Copilothaslinghuis
andcommitted
Fix Enter key detection to use e.which and document listener
Co-authored-by: haslinghuis <[email protected]>
1 parent 4d79561 commit 50abdb4

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/js/gui.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -383,17 +383,16 @@ class GuiControl {
383383

384384
const confirmAction = () => {
385385
dialog[0].close();
386-
dialog.off("keydown");
386+
$(document).off("keydown.informationDialog");
387387
resolve();
388388
};
389389

390390
buttonConfirm.on("click", confirmAction);
391391

392392
// Add Enter key support for single-choice dialog
393-
// Remove any previous keydown handlers before adding new one
394-
dialog.off("keydown");
395-
dialog.on("keydown", (e) => {
396-
if (e.key === "Enter") {
393+
$(document).off("keydown.informationDialog");
394+
$(document).on("keydown.informationDialog", (e) => {
395+
if (e.which === 13) {
397396
e.preventDefault();
398397
confirmAction();
399398
}

0 commit comments

Comments
 (0)