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

Regression: React 16 automatically marks first item of a select with size > 1 as checked #14239

Closed
kamituel opened this issue Nov 15, 2018 · 4 comments

Comments

@kamituel
Copy link

Do you want to request a feature or report a bug?

Bug - regression

What is the current behavior?

In react 16 when creating a <select size="3"> (size > 1) the first child is automatically getting marked as selected. In React 16 there does not seem to be a way to specify no gets selected by default

https://codesandbox.io/s/m76ozkwm89

What is the expected behavior?

In React 15 unless you marked an option to be selected no options were selected by default.

https://codesandbox.io/s/6894m3k9w

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

Reproducible in Chrome 72 and Firefox 59.

Note: this is almost a duplicate of #12200. In fact, I copied issue text and codesandbox examples, just changing multiple to size="3".

@kanlanc
Copy link

kanlanc commented Nov 24, 2018

Can I take this issue?

@nhunzaker
Copy link
Contributor

nhunzaker commented Feb 19, 2019

Interesting!

Here's a manual DOM example of what we're doing:
https://codepen.io/nhunzaker/pen/gqEvjj

It also looks like this is not necessary if a select is already in "multiple" mode.

@nhunzaker
Copy link
Contributor

@highskillzz sorry to get back late to this. #14242 is close to a fix.

@gaearon
Copy link
Collaborator

gaearon commented Mar 22, 2019

Fixed in 16.8.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants