Revert "fix(ui): prevent button from being clicked twice when pressing enter key"

This reverts commit 9a15dc9eb2.
pull/10832/head
situ2001 2024-01-07 15:14:49 +08:00 committed by Tienson Qin
parent 38404da920
commit 336de83f5b
1 changed files with 3 additions and 17 deletions

View File

@ -1039,23 +1039,9 @@
(defn button
[text & {:keys []
:as opts}]
(let [origin-on-key-down (get opts :on-key-down)
class-name (get opts :class)
wrapped-on-key-down (if (and
class-name
;; hint: mixins/on-key-down defined in ui/modal
(string/includes? class-name "ui__modal-enter"))
(fn [e]
(when origin-on-key-down (origin-on-key-down e))
(let [key-code (.-keyCode e)]
(cond
;; enter
(= key-code 13) (util/stop-propagation e))))
origin-on-key-down)
opts (assoc opts :on-key-down wrapped-on-key-down)]
(if (map? text)
(button-inner nil text)
(button-inner text opts))))
(if (map? text)
(button-inner nil text)
(button-inner text opts)))
(rum/defc point
([] (point "bg-red-600" 5 nil))