Add text selection on focus of an input-with-values (#5909)

This commit is contained in:
Pablo Alba 2025-02-19 16:51:49 +01:00 committed by GitHub
parent a3e74c55f1
commit 195127b099
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)