-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
File Block: Remove the download attribute #10693
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR, @Copons!
I noticed when testing this, the 'button' still says download, which is misleading for the user:
I think we should consider removing this button entirely or alternatively changing the default text (could be changed to something like 'open').
The other part that's misleading is the toggle option in the sidebar:
This could be removed or perhaps changed to just 'Show button'.
// ensure download attribute is still set when fileName | ||
// is undefined. Using '' here as `true` still leaves | ||
// the attribute unset. | ||
download={ getTextContent( create( { html: fileName } ) ) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing the download attribute makes the button style link somewhat redundant in the File block. It ends up doing the same thing as the other link.
I wonder if we'd consider removing it - that would probably need a designer's input
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to remove the download
attribute, we just need to set it with no value.
}, | ||
// Differs to the href when the block is configured to link to the attachment page | ||
textLinkHref: { | ||
type: 'string', | ||
source: 'attribute', | ||
selector: 'a:not([download])', | ||
selector: '.wp-block-file__link', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we did remove the download button, this selector could be changed back to a
Thanks for the review @talldan, you made some very interesting points.
I'd argue that the button would still have a value as a CTA. Off the top of my head, I can think of a couple of way to keep the button still useful, even without a behaviour of its own:
Both these points make much sense to me, but of course let's wait for a design look. 🙂 |
We don't need to remove the For sites that use a CDN for hosting uploads, you could use a file passthrough handler to add the |
// ensure download attribute is still set when fileName | ||
// is undefined. Using '' here as `true` still leaves | ||
// the attribute unset. | ||
download={ getTextContent( create( { html: fileName } ) ) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to remove the download
attribute, we just need to set it with no value.
Replaced by #10948 |
Description
Remove the
download
attribute from the File block's "Download" button.The addition of the
download
attribute fora
tags to thewp_kses
whitelist has been recently blocked (cc @pento):It makes sense to me to just remove the attribute altogether from the File block, and leave to the user the decision of saving the file instead of navigating to it.
How has this been tested?
Manually on a local environment, checking for regressions.
Checklist: