-
-
Notifications
You must be signed in to change notification settings - Fork 140
value= shouldn't be converted to defaultValue= for <option> #625
Copy link
Copy link
Closed
Description
The value of <option> tags of <select> are fixed. Converting their value= to defaultValue= results bug if the option label is different from the value. For example:
<select name="range" value="gte-2">
<option value="lt-1">Less than 1</option>
<option value="gte-2">≥2<option>
</select>The value of <select>'s "gte-2" won't get a match and it will fallback to "Less than 1".
html-react-parser/lib/attributes-to-props.js
Lines 42 to 49 in cffffc7
| // convert attribute to uncontrolled component prop (e.g., `value` to `defaultValue`) | |
| // https://reactjs.org/docs/uncontrolled-components.html | |
| if ( | |
| (propName === 'checked' || propName === 'value') && | |
| !inputIsValueOnly | |
| ) { | |
| propName = getPropName('default' + attributeNameLowerCased); | |
| } |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels