Skip to content
New issue

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

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

Already on GitHub? # to your account

With Om, updating an input's value that's tied to state resets the cursor #10

Closed
cpetzold opened this issue Jan 31, 2014 · 2 comments
Closed

Comments

@cpetzold
Copy link

This happens when you have an input tied to state with on-change:

(om/component
 (html [:input {:value (:foo state)
                      :on-change #(om/set-state! state :foo (.. % -target -value))}]))

The cursor is moved to the end after each update.

The fix in om.dom is to special case input elements to ensure they aren't re-rendered on update: https://github.com/swannodette/om/blob/master/src/om/dom.cljs#L7

@r0man
Copy link
Owner

r0man commented Feb 1, 2014

Patch without dependencies welcome.

@r0man r0man closed this as completed in 8bcbef9 Feb 1, 2014
@r0man
Copy link
Owner

r0man commented Feb 1, 2014

Fixed in 0.2.4. I copied the code from om.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants