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

Refs broken for inputs with :value #212

Closed
martinklepsch opened this issue Jun 12, 2020 · 4 comments
Closed

Refs broken for inputs with :value #212

martinklepsch opened this issue Jun 12, 2020 · 4 comments

Comments

@martinklepsch
Copy link
Contributor

(rum/defcs InputRefTestHook
  [s]
  (let [r (rum/create-ref)]
  [:input
   {:width 20
    :ref r
    :value "test" 
    :on-focus #(js/console.log (rum/deref r))}]))

log output with :value "test"

CleanShot 2020-06-12 at 10 03 22@2x

log output without :value

CleanShot 2020-06-12 at 10 03 43@2x

The old approach of using rum/dom-node seems to work fine with inputs that have a :value key.

@roman01la
Copy link
Collaborator

Hmmmm, I think this might be related to the fact that Sablono wraps inputs into a component (to work around async updates and jumping caret issues).

So with value set you get an instance of a wrapper component, but w/o value attr Sablono doesn't wrap the input which gives you a plain DOM node.

@roman01la
Copy link
Collaborator

Once #205 goes in we won't have input wrappers anymore.

@g7s
Copy link

g7s commented Jun 25, 2020

Yeah this issue has been unresolved since 2016 r0man/sablono#121

@roman01la
Copy link
Collaborator

fixed in 0.12.0

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

3 participants