mdgriffith / style-elements

Create styles that don't mysteriously break!
http://package.elm-lang.org/packages/mdgriffith/style-elements/latest
BSD 3-Clause "New" or "Revised" License
445 stars 49 forks source link

`downloadAs` does not set "download" attribute properly #94

Closed benthomasveeva closed 7 years ago

benthomasveeva commented 7 years ago

The big picture of what I'm trying to do

I am trying to make a download link, and set the filename that the file is downloaded as.

What I did

I used Element.downloadAs.

What I Expected To Happen

I expected the file to download with the specified filename.

What Actually Happened

It downloaded as "true.csv" (It was a csv file, so that part is expected). Looking at the generated html, it appears that the "download" attribute is not being set properly on the a node. The "download" attribute was set to "true", which seems to be why the file is being called "true.csv".

When I create the link using Html.a and Html.Attributes.downloadAs, the "download" attribute is set to the specified filename.

When I create the link using Html.a and both Html.Attributes.downloadAs and Html.Attributes.download, then I see the same behavior as using Element.downloadAs. I believe that this means that we simply need to remove the Html.Attributes.download part from Element.downloadAs's definition.

Please see the following Ellie: https://ellie-app.com/5KhDvPXhTa1/2

This Ellie

Versions

mdgriffith commented 7 years ago

Thanks for this!

I've removed Html.Attributes.download from the Element.downloadAs in 4.2, which I just release.

Also, nicely written issue, it made fixing this super easy :)