Skip to content

Commit

Permalink
fix(app): actions were invoked twice when a focused OK button was act…
Browse files Browse the repository at this point in the history
…ivated using Enter key
  • Loading branch information
tuner committed Mar 27, 2024
1 parent 351d9a1 commit 5609151
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/app/src/utils/ui/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,21 @@ export function createModal(type = "default", container = document.body) {
return;
}

if (
/** @type {HTMLElement} */ (event.target).closest(
".modal-buttons"
)
) {
return;
}

const button = /** @type {HTMLButtonElement} */ (
root.querySelector(".btn-primary")
);
button.click();
event.stopPropagation();
if (button) {
button.click();
event.stopPropagation();
}
break;
}
default:
Expand Down

0 comments on commit 5609151

Please sign in to comment.