From 195127b099c311707c4d3d65429d4822aa2f020a Mon Sep 17 00:00:00 2001 From: Pablo Alba Date: Wed, 19 Feb 2025 16:51:49 +0100 Subject: [PATCH] :sparkles: Add text selection on focus of an input-with-values (#5909) --- frontend/src/app/main/ui/ds/controls/input_with_values.cljs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend/src/app/main/ui/ds/controls/input_with_values.cljs b/frontend/src/app/main/ui/ds/controls/input_with_values.cljs index 56c97a32ae..42aa8137f7 100644 --- a/frontend/src/app/main/ui/ds/controls/input_with_values.cljs +++ b/frontend/src/app/main/ui/ds/controls/input_with_values.cljs @@ -44,6 +44,11 @@ (reset! editing* false) (when on-blur (on-blur new-name))))) + on-focus + (mf/use-fn + (fn [event] + (dom/stop-propagation event) + (dom/select-text! (dom/get-target event)))) handle-key-down (mf/use-fn @@ -61,6 +66,7 @@ :class (stl/css :input-with-values-editing) :default-value name :auto-focus true + :on-focus on-focus :on-blur on-stop-edit :on-key-down handle-key-down}]] [:div {:class (stl/css :input-with-values-container :input-with-values-grid)