Skip to content

Reset of select ignores defaultValue #11010

@ZeHiro

Description

@ZeHiro

Do you want to request a feature or report a bug?
I report a bug.
What is the current behavior?
When resetting a form which contains a select with a defaultValue, the selected option becomes the first option element in the list, not the one with value=defaultValue.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via https://jsfiddle.net or similar (template: https://jsfiddle.net/ebsrpraL/).
I have put a piece of code here :
https://codepen.io/zehiro/pen/YrxZWw?editors=1111#0

Click on the reset button, which just does a form.reset() on the form.
What is the expected behavior?
I expect the select to select the option with value=defaultValue (like applying a form.reset() on a <input/>
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
React-DOM 15.6.2.
It seems to be browser independent (tried with Chromium 61 and firefox 55 for Fedora).
I didn't try this on prior version of React.

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