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

React :ref not working on input #121

Open
lgrapenthin opened this issue Jun 13, 2016 · 1 comment
Open

React :ref not working on input #121

lgrapenthin opened this issue Jun 13, 2016 · 1 comment

Comments

@lgrapenthin
Copy link

lgrapenthin commented Jun 13, 2016

A fn passed as :ref is not invoked with the DOM element but the component class instance.

Is there a way to avoid wrap-form-element, probably via a metadata hint? Also I'd be curious to know what the purpose of wrap-form-element is.

https://facebook.github.io/react/docs/more-about-refs.html#the-ref-callback-attribute

@r0man
Copy link
Owner

r0man commented Jun 13, 2016

@lgrapenthin I wasn't aware that :ref also takes a fn. Looks like they also plan to deprecate the use of strings as a :ref value. At the moment it is not possible to avoid wrap-form-element.

wrap-form-element is copied over from om to make sure controlled inputs behave properly. I think we had problems with input fields loosing state like the cursor position. But to be honest I can't remember the exact details anymore :)

I think a fix for your issue could be to pass the :ref in wrap-form-element down to the actual input element. Patch with test welcome!

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