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 15 regression: controlled select elements with optgroup not displaying value on initial render #6547

Closed
mavisd opened this issue Apr 19, 2016 · 3 comments

Comments

@mavisd
Copy link

mavisd commented Apr 19, 2016

Using React 15.0.1, controlled select elements with optgroup elements are not displaying (selecting) the value provided on initial render. See the following jsfiddle for a simple test case:

https://jsfiddle.net/Artconnoisseur/eg3j7fam/1/

Here is another fiddle where it is working using React 0.14.8:

https://jsfiddle.net/Artconnoisseur/hfp8rf1j/1/

@evenstensberg
Copy link

SO

Could you try setting bind() in your render method? The SO questions and replies should give you a indication of how you would do that.

@subblue
Copy link

subblue commented Apr 19, 2016

@mavisd I've been seeing the same behaviour in my React 15.0.1 app too.
For the moment I've been falling back to setting the selected attribute on the selected option tag (which does trigger the React warning about using the defaultValue or value on the select instead)

@gaearon
Copy link
Collaborator

gaearon commented Apr 19, 2016

@ev1stensberg

bind() is not necessary with React.createClass() as the methods are autobound. Also the code is identical but behaves differently in different versions, so it’s an indication that it might be React’s fault.

@mavisd

I think this is the same as #6440 and #6434, and was fixed in #6442. The fix is not out in 15.0.1, but it should get into the next patch release. I can confirm this working with the build from the master:

screen shot 2016-04-19 at 15 32 18

I’m closing for this reason.

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

4 participants