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

ReactLink doesn't work for input type="range" #437

Closed
phou87 opened this issue Oct 20, 2013 · 8 comments · Fixed by #438
Closed

ReactLink doesn't work for input type="range" #437

phou87 opened this issue Oct 20, 2013 · 8 comments · Fixed by #438

Comments

@phou87
Copy link

phou87 commented Oct 20, 2013

Can't provide a fiddle since it doesn't support 0.5.0 yet, but I get this error:

Uncaught InvalidStateError: An attempt was made to use an object that is not, or is no longer, usable.

Works fine with other types of inputs.

@sophiebits
Copy link
Collaborator

Could you make a fiddle using http://jsfiddle.net/spicyj/BrU6B/ as a starting point? Thanks.

@phou87
Copy link
Author

phou87 commented Oct 20, 2013

@sophiebits
Copy link
Collaborator

Looks like SelectEventPlugin's getSelection accesses .selectionStart on the range input which throws an exception because it isn't a text input (as specified in the DOM spec: http://www.w3.org/TR/2009/WD-html5-20090423/editing.html#textFieldSelection). (cc @joshduck)

@phou87
Copy link
Author

phou87 commented Oct 20, 2013

In fact, this looks like it happens even if you make a custom onChange handler. Meaning it's very hard to use range selectors in React. :(

sophiebits added a commit to sophiebits/react that referenced this issue Oct 20, 2013
Accessing .selectionStart on a non-text input will throw (see http://www.w3.org/TR/2009/WD-html5-20090423/editing.html#textFieldSelection), so check that the input has selection capabilities before accessing the property.

Fixes facebook#437.
@vjeux
Copy link
Contributor

vjeux commented Oct 20, 2013

I updated the JSFiddle links when we upgraded to 0.5.0, aren't they working / where did you get your fiddle link?

http://facebook.github.io/react/docs/getting-started.html

@sophiebits
Copy link
Collaborator

http://jsfiddle.net/vjeux/25Rhk/ and http://jsfiddle.net/zpao/uaKdV/ are both older versions.

@zpao
Copy link
Member

zpao commented Oct 21, 2013

@phou87 Thanks a lot for reporting! We'll roll this into the next release.

@phou87
Copy link
Author

phou87 commented Oct 21, 2013

No problem, thanks for the quick turnaround! When is the next release?

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

Successfully merging a pull request may close this issue.

4 participants