Skip to content

Commit

Permalink
Close search modal on Escape keypress
Browse files Browse the repository at this point in the history
  • Loading branch information
fidel committed Apr 4, 2024
1 parent 9b60202 commit 10cf276
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ruby_event_store-browser/public/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ window.addEventListener("keydown", function (event) {
app.ports.requestSearch.send(null);
event.preventDefault();
}

if (event.key === "Escape") {
const dialog = document.querySelector(`#${id}`);
dialog.open ? dialog.close() : null;
event.preventDefault();
}
});

app.ports.toggleBookmark.subscribe(function (id) {
Expand Down

0 comments on commit 10cf276

Please sign in to comment.