[wp-trac] [WordPress Trac] #48463: Copy link button in media
WordPress Trac
noreply at wordpress.org
Thu Jun 4 14:19:38 UTC 2020
#48463: Copy link button in media
-------------------------------------+-------------------------------------
Reporter: theolg | Owner: audrasjb
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 5.5
Component: Media | Version: 5.2
Severity: normal | Resolution:
Keywords: has-screenshots needs- | Focuses: ui, accessibility,
patch | javascript
-------------------------------------+-------------------------------------
Changes (by afercia):
* keywords: has-patch needs-testing has-screenshots needs-dev-note needs-
refresh => has-screenshots needs-patch
Comment:
Thanks for the patches and the work done here! Looking at
[attachment:"48463.3.diff"] I'm not sure that's the best approach.
- I would recommend to not use `window.clipboardData` and
`document.execCommand()`.
- Instead, I'd recommend to use `ClipboardJS` which is already used in the
Site Health > Info page: it has all it's needed and allows for a much
simpler implementation. For an example, see `src/js/_enqueues/admin/site-
health.js`
- The same code shouldn't be replicated in two different places: the patch
introduces two new functions in the attachment `details.js` and in
`post.js` that do the same thing. Not sure there's the need to have this
code in `post.js` in the first place, unless I'm missing something.
- Translatable strings for JS can be provided via `wp.i18n`.
- I don't think the copy button should be displayed within the input
field.
- The state message should be separated from the button and the button
text should not change, following the accessibility team feedback and also
for consistency with the implementation in Site Health (see attached
screenshot).
I will try to make a new patch soon.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/48463#comment:38>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list