virtual-dom icon indicating copy to clipboard operation
virtual-dom copied to clipboard

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

Open zwilias opened this issue 7 years ago • 1 comments

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 value in applyFacts: the current condition does not cover the case where appending children changes the value property.

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!

zwilias avatar Dec 05 '17 20:12 zwilias

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.

process-bot avatar Dec 05 '17 20:12 process-bot