elm / html

Use HTML in Elm!
https://package.elm-lang.org/packages/elm/html/latest/
BSD 3-Clause "New" or "Revised" License
395 stars 99 forks source link

`for` should be an `attribute` rather than a `property` #148

Open decioferreira opened 7 years ago

decioferreira commented 7 years ago

Link to SSCCE: https://ellie-app.com/kGcc5FVT7a1/4

As described on the example, when a label element without a for property is replaced by one that has the for property on the DOM tree, when re-adding the first element it will be rendered with a for property with value of "empty string".

After talking with @zwilias, this seems to be related with #142 and a workaround seems to be:

for_ : String -> Html.Attribute msg
for_ =
    Html.Attributes.attribute "htmlFor"

A working example with this workaround can be found on https://ellie-app.com/mckMkM7SZa1/1

Also, the relevant spec: https://html.spec.whatwg.org/multipage/forms.html#the-label-element

process-bot commented 7 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.