Skip to content

Commit

Permalink
Always be closing
Browse files Browse the repository at this point in the history
Escape shouldn't toggle but always close the modal.
  • Loading branch information
fidel committed Apr 4, 2024
1 parent 25cc5d8 commit ac1b713
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ruby_event_store-browser/elm/src/Layout.elm
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ port requestSearch : (() -> msg) -> Sub msg
port requestSearchClose : (() -> msg) -> Sub msg


port closeSearch : String -> Cmd msg


port toggleBookmark : String -> Cmd msg


Expand Down Expand Up @@ -151,7 +154,7 @@ update msg model =
( model, toggleDialog searchModalId )

RequestSearchClose ->
( model, toggleDialog searchModalId )
( model, closeSearch searchModalId )

ToggleBookmarksMenu ->
( { model | internal = Model model.internal.search (not model.internal.displayBookmarksMenu) model.internal.bookmarks }, Cmd.none )
Expand Down
4 changes: 4 additions & 0 deletions ruby_event_store-browser/public/bootstrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ app.ports.toggleDialog.subscribe(function (id) {
dialog.open ? dialog.close() : dialog.showModal();
});

app.ports.closeSearch.subscribe(function (id) {
document.querySelector(`#${id}`).close();
});

window.addEventListener("keydown", function (event) {
if (event.key === "k" && (event.ctrlKey || event.metaKey)) {
app.ports.requestSearch.send(null);
Expand Down

0 comments on commit ac1b713

Please sign in to comment.