Skip to content

React 15: select with value not working with optgroups #6552

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

Closed
statianzo opened this issue Apr 20, 2016 · 4 comments
Closed

React 15: select with value not working with optgroups #6552

statianzo opened this issue Apr 20, 2016 · 4 comments

Comments

@statianzo
Copy link

statianzo commented Apr 20, 2016

Since upgrading to React 15.0.1, when rendering <select> with optgroups, the value is not set on the DOM correctly. The first option will always get picked.

// Renders with "Yes" selected, I expect "Maybe"
  <select value={3}>
    <optgroup label="One">
    <option value={1}>Yes</option>
    </optgroup>
    <optgroup label="Two">
    <option value={2}>No</option>
    </optgroup>
    <optgroup label="Three">
    <option value={3}>Maybe</option>
    </optgroup>
  </select>

Examples

React 15.0.1 Fiddle (broken)
React 0.14.7 Fiddle (works)
React 15.0.1 without optgroup Fiddle (works)

Environment

OS X 10.11.4
Safari Version 9.1 (11601.5.17.1)
Chrome Version 49.0.2623.110 (64-bit)
Firefox 45.0.1

Edit: I also noticed that the same behavior occurs when using defaultValue.

@mshenfield
Copy link

@gaearon
Copy link
Collaborator

gaearon commented Apr 20, 2016

Hi, thanks for reporting. This is a duplicate of #6547 and two other issues linked from there. It is fixed in master but this fix hasn't gotten into a release yet. Let's keep this open so people don't file more issues.

@statianzo
Copy link
Author

Great to hear the fix is coming. Thanks, @gaearon!

@jimfb
Copy link
Contributor

jimfb commented Apr 20, 2016

Fixed in #6442

@gaearon We generally close out issues when things have been merged into master. The reason is that otherwise, it's too hard to tell what is still an active item (needs to be fixed) verses things that are already fixed and remain open only to help people find them. You could read through all the comments, but that takes time (especially if you're going through a bunch of them) and they are often nuanced with regards to remaining action items. You don't want to read through an hour of comments, only to discover that the whole thing is fixed and no longer relevant.

@jimfb jimfb closed this as completed Apr 20, 2016
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