Skip to content

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

Closed
@kamituel

Description

@kamituel

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".

Activity

kanlanc

kanlanc commented on Nov 24, 2018

@kanlanc

Can I take this issue?

nhunzaker

nhunzaker commented on Feb 19, 2019

@nhunzaker
Contributor

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

nhunzaker commented on Feb 19, 2019

@nhunzaker
Contributor

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

gaearon

gaearon commented on Mar 22, 2019

@gaearon
Collaborator

Fixed in 16.8.5.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @philipp-spiess@nhunzaker@kamituel@gaearon@kanlanc

        Issue actions

          Regression: React 16 automatically marks first item of a select with size > 1 as checked · Issue #14239 · facebook/react