html icon indicating copy to clipboard operation
html copied to clipboard

Value vs Attribute "value"

Open jalandis opened this issue 4 years ago • 1 comments

There is difference between the Html generated by Html.Attributes.attribute "value" "" and Html.Attributes.value "" that leads to some unexpected behaviour.

To illustrate the issue, here is an example select element with 2 options.
https://ellie-app.com/8xvjpZt6NwSa1

select 
  [ onInput Pick ] 
  [ option [ value "" ] [ text "Empty Value" ]
  , option [ selected True, attribute "value" "" ] [ text "Empty Attribute Value" ]
  ]

Switching options 3 times produces the following inconsistent messages.

Pick "Empty Value"
Pick ""
Pick ""

jalandis avatar Apr 08 '20 17:04 jalandis

This seems to be more general than just Html.Attributes.value.

Html.Attributes.selected is broken, too:

For the following code:

main =
    Html.div []
        [ Html.select []
            [ Html.option [ Attr.selected True ] [ Html.text "Value A" ]
            , Html.option [] [ Html.text "Value B" ]
            ]
        ]

No selected value is added to the DOM.

Ellie: https://ellie-app.com/h4rZFfTtWj3a1

jmpavlick avatar Mar 28 '22 13:03 jmpavlick