Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Value vs Attribute "value" #209

Open
jalandis opened this issue Apr 8, 2020 · 1 comment
Open

Value vs Attribute "value" #209

jalandis opened this issue Apr 8, 2020 · 1 comment

Comments

@jalandis
Copy link

jalandis commented Apr 8, 2020

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 ""
@jmpavlick
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants