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

Don't set a value on the file block download attribute #10976

Merged
merged 2 commits into from Oct 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions packages/block-library/src/file/index.js
Expand Up @@ -217,8 +217,7 @@ export const settings = {
<a
href={ href }
className="wp-block-file__button"
// Using '' here as `true` leaves the attribute unset.
download=""
download={ true }
>
<RichText.Content
value={ downloadButtonText }
Expand Down
1 change: 1 addition & 0 deletions packages/blocks/src/api/validation.js
Expand Up @@ -57,6 +57,7 @@ const BOOLEAN_ATTRIBUTES = [
'default',
'defer',
'disabled',
'download',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, so this was the missing piece! 🤦‍♂️

'formnovalidate',
'hidden',
'ismap',
Expand Down
1 change: 1 addition & 0 deletions packages/element/src/serialize.js
Expand Up @@ -116,6 +116,7 @@ const BOOLEAN_ATTRIBUTES = new Set( [
'default',
'defer',
'disabled',
'download',
'formnovalidate',
'hidden',
'ismap',
Expand Down
@@ -1,3 +1,3 @@
<!-- wp:file {"href":"http://localhost:8888/wp-content/uploads/2018/05/keycodes.js","showDownloadButton":true,"id":176} -->
<div class="wp-block-file"><a href="http://localhost:8888/wp-content/uploads/2018/05/keycodes.js" target="_blank" rel="noreferrer noopener">6546</a><a href="http://localhost:8888/wp-content/uploads/2018/05/keycodes.js" class="wp-block-file__button" download="">Download</a></div>
<div class="wp-block-file"><a href="http://localhost:8888/wp-content/uploads/2018/05/keycodes.js" target="_blank" rel="noreferrer noopener">6546</a><a href="http://localhost:8888/wp-content/uploads/2018/05/keycodes.js" class="wp-block-file__button" download>Download</a></div>
<!-- /wp:file -->
Expand Up @@ -13,6 +13,6 @@
"downloadButtonText": "Download"
},
"innerBlocks": [],
"originalContent": "<div class=\"wp-block-file\"><a href=\"http://localhost:8888/wp-content/uploads/2018/05/keycodes.js\" target=\"_blank\" rel=\"noreferrer noopener\">6546</a><a href=\"http://localhost:8888/wp-content/uploads/2018/05/keycodes.js\" class=\"wp-block-file__button\" download=\"\">Download</a></div>"
"originalContent": "<div class=\"wp-block-file\"><a href=\"http://localhost:8888/wp-content/uploads/2018/05/keycodes.js\" target=\"_blank\" rel=\"noreferrer noopener\">6546</a><a href=\"http://localhost:8888/wp-content/uploads/2018/05/keycodes.js\" class=\"wp-block-file__button\" download>Download</a></div>"
}
]
Expand Up @@ -7,7 +7,7 @@
"id": 176
},
"innerBlocks": [],
"innerHTML": "\n<div class=\"wp-block-file\"><a href=\"http://localhost:8888/wp-content/uploads/2018/05/keycodes.js\" target=\"_blank\" rel=\"noreferrer noopener\">6546</a><a href=\"http://localhost:8888/wp-content/uploads/2018/05/keycodes.js\" class=\"wp-block-file__button\" download=\"\">Download</a></div>\n"
"innerHTML": "\n<div class=\"wp-block-file\"><a href=\"http://localhost:8888/wp-content/uploads/2018/05/keycodes.js\" target=\"_blank\" rel=\"noreferrer noopener\">6546</a><a href=\"http://localhost:8888/wp-content/uploads/2018/05/keycodes.js\" class=\"wp-block-file__button\" download>Download</a></div>\n"
},
{
"blockName": null,
Expand Down
@@ -1,3 +1,3 @@
<!-- wp:file {"id":176,"href":"http://localhost:8888/wp-content/uploads/2018/05/keycodes.js"} -->
<div class="wp-block-file"><a href="http://localhost:8888/wp-content/uploads/2018/05/keycodes.js" target="_blank" rel="noreferrer noopener">6546</a><a href="http://localhost:8888/wp-content/uploads/2018/05/keycodes.js" class="wp-block-file__button" download="">Download</a></div>
<div class="wp-block-file"><a href="http://localhost:8888/wp-content/uploads/2018/05/keycodes.js" target="_blank" rel="noreferrer noopener">6546</a><a href="http://localhost:8888/wp-content/uploads/2018/05/keycodes.js" class="wp-block-file__button" download>Download</a></div>
<!-- /wp:file -->
@@ -1,3 +1,3 @@
<!-- wp:file {"href":"http://localhost:8888/wp-content/uploads/2018/05/keycodes.js","showDownloadButton":true,"id":176} -->
<div class="wp-block-file"><a href="http://localhost:8888/wp-content/uploads/2018/05/keycodes.js" class="wp-block-file__button" download="">Download</a></div>
<div class="wp-block-file"><a href="http://localhost:8888/wp-content/uploads/2018/05/keycodes.js" class="wp-block-file__button" download>Download</a></div>
<!-- /wp:file -->
Expand Up @@ -11,6 +11,6 @@
"downloadButtonText": "Download"
},
"innerBlocks": [],
"originalContent": "<div class=\"wp-block-file\"><a href=\"http://localhost:8888/wp-content/uploads/2018/05/keycodes.js\" class=\"wp-block-file__button\" download=\"\">Download</a></div>"
"originalContent": "<div class=\"wp-block-file\"><a href=\"http://localhost:8888/wp-content/uploads/2018/05/keycodes.js\" class=\"wp-block-file__button\" download>Download</a></div>"
}
]
Expand Up @@ -7,7 +7,7 @@
"id": 176
},
"innerBlocks": [],
"innerHTML": "\n<div class=\"wp-block-file\"><a href=\"http://localhost:8888/wp-content/uploads/2018/05/keycodes.js\" class=\"wp-block-file__button\" download=\"\">Download</a></div>\n"
"innerHTML": "\n<div class=\"wp-block-file\"><a href=\"http://localhost:8888/wp-content/uploads/2018/05/keycodes.js\" class=\"wp-block-file__button\" download>Download</a></div>\n"
},
{
"blockName": null,
Expand Down
@@ -1,3 +1,3 @@
<!-- wp:file {"id":176,"href":"http://localhost:8888/wp-content/uploads/2018/05/keycodes.js"} -->
<div class="wp-block-file"><a href="http://localhost:8888/wp-content/uploads/2018/05/keycodes.js" class="wp-block-file__button" download="">Download</a></div>
<div class="wp-block-file"><a href="http://localhost:8888/wp-content/uploads/2018/05/keycodes.js" class="wp-block-file__button" download>Download</a></div>
<!-- /wp:file -->