Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[:input {:type "number"}] is broken in 0.6.0 #289

Closed
minikomi opened this issue Mar 17, 2017 · 8 comments
Closed

[:input {:type "number"}] is broken in 0.6.0 #289

minikomi opened this issue Mar 17, 2017 · 8 comments

Comments

@minikomi
Copy link

Using a reagent/atom with an [:input {:type "number"}] has odd behavior in 0.6.0.

Seems to be working in 0.6.0-alpha.

Minimal example:

(ns inputtest.core
    (:require [reagent.core :as reagent :refer [atom]]))

(def value (atom 0))

(defn atom-input []
  [:input {:type "number"
           :value @value
           :step "any"
           :on-change #(reset! value (-> % .-target .-value))}])

;; -------------------------
;; Initialize app

(defn mount-root []
  (reagent/render [atom-input] (.getElementById js/document "app")))

(defn init! []
  (mount-root))

Trying to type a decimal point will reset the cursor to the start of the input, then pressing decimal again clears/resets the input.

@minikomi minikomi changed the title Number input is broken in 0.6.0 [:input {:type "number"}] is broken in 0.6.0 Mar 17, 2017
@minikomi
Copy link
Author

Cljsfiddle - which is running on 0.6.0-alpha - does not exhibit this problem.

@minikomi
Copy link
Author

Appears to be a react bug: facebook/react#8717

@Deraen
Copy link
Member

Deraen commented Mar 17, 2017

0.6.1 has input related changes, did you try with that?

@minikomi
Copy link
Author

0.6.1 has input related changes, did you try with that?

Still exhibits the same problem. Seems it was a react problem and was fixed in 15.4.2 .

@Deraen
Copy link
Member

Deraen commented Mar 19, 2017

You can test the fix by upgrading you React dependencies:

                 [cljsjs/react-dom "15.4.2-2"]
                 [cljsjs/react-dom-server "15.4.2-2"]

@minikomi
Copy link
Author

Yep, confirmed upgrading react dependency fixes it.

Deraen added a commit that referenced this issue Mar 19, 2017
@Deraen
Copy link
Member

Deraen commented Mar 19, 2017

I updated the version. I'm not yet sure if I want to create minor release with this fix or wait for other fixes.

@Deraen
Copy link
Member

Deraen commented May 19, 2017

Reagent 0.6.2 has been released with upgraded React dependency.

@Deraen Deraen closed this as completed May 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants