I encounter strange behavior in a small Elm program with an HTML element select
.
Initially, the options include an empty first element with a value ""
and 3 additional elements with the values "bar", "baz" and "foo".
When the page is initially displayed, the first blank element is selected, as expected.
If then a drop-down list is called up and a bar is selected from the list, the drop-down then shows and selects "baz", not "bar". Note that when an item is selected, the item is select
re-displayed without the first option blank.
Here is the code demonstrating this problem.
Why is this happening? Should I just leave the first element blank in the parameters select
? This will leave an empty “slot” in the drop-down list. Can this be avoided?
I initially found this in Chrome, but it also happens in Firefox, so I suspect I'm violating something in the HTML spec.
Ralph source
share