Skip to content

Regression: React 16 automatically marks first item of a mutliple select as checked #12200

@megawac

Description

@megawac

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 multiple> the first child <option> is automatically getting marked as selected. In React 16 there does not seem to be a way to specify no <option> gets selected by default

https://codesandbox.io/s/moxm2on3z9

What is the expected behavior?

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

https://codesandbox.io/s/ll11z5wqzl

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

Versions effected include react^16.2, this worked in react^0.13 and react^15. This bug is reproducible in chrome 64 and Firefox 58.


The hacky workaround I found to get around the first option getting selected is to inject a <option style={{display: 'none'}} /> as the first child of the multiselect.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions