elm / virtual-dom

The foundation of HTML and SVG in Elm.
https://package.elm-lang.org/packages/elm/virtual-dom/latest
BSD 3-Clause "New" or "Revised" License
209 stars 80 forks source link

`option` with empty `value` and nonempty content misbehaves #119

Open zwilias opened 6 years ago

zwilias commented 6 years ago

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:

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!

process-bot commented 6 years ago

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.