Skip to content

Changing state in onFocus and onChange for a select multiple element does not work in Firefox #6951

@skleeschulte

Description

@skleeschulte

I want to use a controlled <select multiple={true} /> component in React. In addition to the value I also want to keep the focused state of the select in the state. To do this, I update the state with setState in the onChange, onFocus and onBlur event handlers. Unfortunately there is an issue in Firefox: Firefox will only update the value on a change event after the select has gained focus. This means that a user has to click twice on the select element to change its value when it does not have focus. I would expect the select to gain focus and change the value at the same click.

I created a jsFiddle to demonstrate the prolem: React select multiple issue in Firefox demonstration

I only see this problem in Firefox and with select multiple. In IE and Chrome it is working as expected, and in Firefox it is working as expected for other form elements (simple select, checkbox, radio, text input, textarea).

My environment:

  • Firefox 46.0.1 under Win7 x64
  • React 15.1.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions