🐛 Fix focus handling on comment edition

This commit is contained in:
Andrey Antukh 2023-07-07 11:12:49 +02:00 committed by Alejandro Alonso
parent 992dd04b47
commit 9dbf6ffd14
4 changed files with 41 additions and 22 deletions

View file

@ -199,11 +199,6 @@
(when (and (some? current) (not (.contains current target)))
(dom/blur! current)))))))
on-mouse-up
(mf/use-callback
(fn [event]
(dom/prevent-default event)))
handle-focus
(mf/use-callback
(fn [event]
@ -212,9 +207,9 @@
(on-focus event))
(when select-on-focus?
(-> event (dom/get-target) (.select))
(dom/select-text! event)
;; In webkit browsers the mouseup event will be called after the on-focus causing and unselect
(.addEventListener target "mouseup" on-mouse-up #js {"once" true})))))
(.addEventListener target "mouseup" dom/prevent-default #js {:once true})))))
props (-> props
(obj/without ["value" "onChange" "nillable" "onFocus"])