reagent-project / reagent-forms

Bootstrap form components for Reagent
339 stars 78 forks source link

Datepicker wrapped in label #86

Closed hosiawak closed 8 years ago

hosiawak commented 8 years ago

If a datepicker input is wrapped in a [:label] it disappears as soon as any of its buttons are clicked. I presume it's because the datepicker div itself is wrapped in the label and its clicks get propagated up to the label and then from the label down to the input field (browser behaviour). This makes it (swap! expanded? not) and it disappears.

I think the fix is to add e.stopPropagation to every :on-click handler in datepicker but I need to check

(def form
  [:form
   [:label
    [:input {:field :datepicker :id :test}]]])

(defn main []
  (let [doc (r/atom {})]
    (fn []
      [:div
       [:h1 (str "Doc: " @doc)]
       [bind-fields form doc]])))```
yogthos commented 8 years ago

That sounds like the problem, would you be up for doing a pr for this?

hosiawak commented 8 years ago

I would but I have no idea how to import this project tbh so that I can use it locally (Clojure newbie). I have a fork on GH, I can check it out but then what should I do to test it locally ?

yogthos commented 8 years ago

All you have to do to run it locally is run lein install once you check it out. That puts a local jar in your ~/.m2/repository/ folder and that'll get picked up when you use it as a dependency.