diff --git a/ruby_event_store-browser/elm/src/Layout.elm b/ruby_event_store-browser/elm/src/Layout.elm index d4ae6c3920..543f7c8ce4 100644 --- a/ruby_event_store-browser/elm/src/Layout.elm +++ b/ruby_event_store-browser/elm/src/Layout.elm @@ -56,6 +56,9 @@ port requestSearch : (() -> msg) -> Sub msg port requestSearchClose : (() -> msg) -> Sub msg +port closeSearch : String -> Cmd msg + + port toggleBookmark : String -> Cmd msg @@ -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 ) diff --git a/ruby_event_store-browser/public/bootstrap.js b/ruby_event_store-browser/public/bootstrap.js index da8b98d3ae..7669f23bea 100644 --- a/ruby_event_store-browser/public/bootstrap.js +++ b/ruby_event_store-browser/public/bootstrap.js @@ -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);