virtual-dom
virtual-dom copied to clipboard
`option` with empty `value` and nonempty content misbehaves
SSCCE
https://ellie-app.com/937PLf6rLa1/0
Expected behaviour
Selecting the first option (which has value "") should send a message updating the selected value to "". Instead it sends a message with the content of the selected option.
Analysis
The value property of <option></option> is "", while the value of <option>foo</option> is "foo". Since we applyFacts before appending children, we decide not to add the value property.
So I see 2 reasonable strategies to make this more robust:
- switch the order. The impact of doing that is rather unclear.
- change the special casing of
valueinapplyFacts: the current condition does not cover the case where appending children changes thevalueproperty.
Current workaround
Using [ Html.Attribute.attribute "value" "", value "" ] sets the actual value attribute on the node, which makes this behave.
Thanks to @bdukes on Slack for surfacing the issue!
Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!
Here is what to expect next, and if anyone wants to comment, keep these things in mind.