diff --git a/src/main/frontend/components/shortcut.cljs b/src/main/frontend/components/shortcut.cljs index e7be19107e..00fe0b93fa 100644 --- a/src/main/frontend/components/shortcut.cljs +++ b/src/main/frontend/components/shortcut.cljs @@ -263,22 +263,24 @@ ;; keystroke filter button (let [filter-popup-id :shortcut-keystroke-filter open-filter! (fn [^js e] - (set-q! "") - (shui/popup-show! - (.-currentTarget e) - (fn [_] - (keyboard-filter-record-inner - keystroke set-keystroke! - #(shui/popup-hide! filter-popup-id))) - {:id filter-popup-id - :force-popover? true - :align "end" - :content-props - {:class "shortcut-filter-popover-content p-0 w-auto" - :collision-padding 12 - :onOpenAutoFocus #(.preventDefault %) - :onEscapeKeyDown (fn [_] false) - :onPointerDownOutside (fn [_] nil)}}))] + (let [anchor-el (.-currentTarget e)] + (set-q! "") + (shui/popup-show! + anchor-el + (fn [_] + (keyboard-filter-record-inner + keystroke set-keystroke! + #(shui/popup-hide! filter-popup-id))) + {:id filter-popup-id + :force-popover? true + :align "end" + :on-after-hide #(when anchor-el (.focus anchor-el)) + :content-props + {:class "shortcut-filter-popover-content p-0 w-auto" + :collision-padding 12 + :onOpenAutoFocus #(.preventDefault %) + :onEscapeKeyDown (fn [_] false) + :onPointerDownOutside (fn [_] nil)}})))] (if in-keystroke? [:button.shortcut-keystroke-active {:on-click open-filter!} diff --git a/src/main/frontend/components/shortcut.css b/src/main/frontend/components/shortcut.css index 33c33821fb..dbd39d2571 100644 --- a/src/main/frontend/components/shortcut.css +++ b/src/main/frontend/components/shortcut.css @@ -129,7 +129,7 @@ button.shortcut-feedback-action { select-none; height: 30px; padding: 0 10px; - min-width: 0; + min-width: 9rem; border-radius: 6px; border: 1px solid var(--lx-gray-07, var(--ls-quaternary-background-color, var(--rx-gray-07))); background-color: var(--lx-gray-02, var(--ls-secondary-background-color, var(--rx-gray-02))); diff --git a/src/main/frontend/ui.cljs b/src/main/frontend/ui.cljs index dd54ff7818..27a62ff979 100644 --- a/src/main/frontend/ui.cljs +++ b/src/main/frontend/ui.cljs @@ -19,7 +19,6 @@ [frontend.handler.plugin :as plugin-handler] [frontend.mixins :as mixins] [frontend.mobile.util :as mobile-util] - [frontend.modules.shortcut.config :as shortcut-config] [frontend.modules.shortcut.core :as shortcut] [frontend.modules.shortcut.data-helper :as shortcut-dh] [frontend.modules.shortcut.utils :as shortcut-utils] @@ -582,12 +581,11 @@ :aria-hidden "true"}]]])) (defn keyboard-shortcut-from-config [shortcut-name & {:keys [pick-first?]}] - (let [built-in-binding (:binding (get shortcut-config/all-built-in-keyboard-shortcuts shortcut-name)) - custom-binding (when (state/custom-shortcuts) (get (state/custom-shortcuts) shortcut-name)) - binding (or custom-binding built-in-binding)] - (if (and pick-first? (coll? binding)) - (first binding) - (shortcut-utils/decorate-binding binding)))) + (let [binding (shortcut-dh/shortcut-binding shortcut-name)] + (cond + (or (nil? binding) (false? binding)) nil + (and pick-first? (coll? binding)) (first binding) + :else (shortcut-utils/decorate-binding binding)))) (defn dropdown-shortcut "Renders a compact shui shortcut for use inside dropdown menu items. @@ -595,11 +593,9 @@ string (e.g. \"shift+click\"). Returns nil for disabled/missing bindings." [shortcut-or-id] (let [binding (if (keyword? shortcut-or-id) - (let [built-in (:binding (get shortcut-config/all-built-in-keyboard-shortcuts shortcut-or-id)) - custom (when (state/custom-shortcuts) (get (state/custom-shortcuts) shortcut-or-id)) - b (or custom built-in)] + (let [b (shortcut-dh/shortcut-binding shortcut-or-id)] (when (and b (not (false? b))) - (if (coll? b) (first b) b))) + (first b))) shortcut-or-id)] (when binding [:span.ml-auto.pl-2