[wp-trac] [WordPress Trac] #50335: Privacy Policy Guide page: Improvements for the Copy button

WordPress Trac noreply at wordpress.org
Sun Jun 7 18:07:45 UTC 2020


#50335: Privacy Policy Guide page: Improvements for the Copy button
-------------------------------------+-------------------------------------
 Reporter:  afercia                  |       Owner:  (none)
     Type:  defect (bug)             |      Status:  new
 Priority:  normal                   |   Milestone:  5.5
Component:  Privacy                  |     Version:  trunk
 Severity:  normal                   |  Resolution:
 Keywords:  has-screenshots has-     |     Focuses:  accessibility,
  patch                              |  javascript
-------------------------------------+-------------------------------------
Changes (by afercia):

 * keywords:  has-screenshots => has-screenshots has-patch
 * version:   => trunk
 * milestone:  Awaiting Review => 5.5


Comment:

 Thanks @garrett-eclipse, I went through #44588 and now have a better
 understanding of all the bits around this functionality.

 I'd say to start simple :) [attachment:"50335.diff"]:

 - clears the timeout when clicking the button
 - minor JS coding standards
 - makes the visual order match the DOM order
 - improves the `return-to-top` link: link should never use a `href`
 attribute with only a `#`: that's just an incomplete URL fragment
 identifier, see the accessibility coding standards
 https://developer.wordpress.org/coding-standards/wordpress-coding-
 standards/accessibility/#semantics-for-controls
 - removes the redundant `screen-reader-text`
 - hides the up arrow `↑` as it was unnecessarily announced by screen
 readers


 Regarding keeping the formatting in the copied text: I do think
 `ClipboardJS` can do that when set up correctly. I saw on #44588 that
 `data-clipboard-target` was already tried. There's also the option to pass
 a DOM element, see https://github.com/zenorocha/clipboard.js#advanced-
 options. Also, `ClipboardJS` has an internal method to clear the selection
 that can be used after a successful copy action so the "highlighted" text
 can be de-selected.

 I'd still lean towards trying `ClipboardJS`. Internally, it uses the same
 methods used in this custom implementation so I don't see a reason to not
 use it :) The advantage is that it does that in a more standardized way.
 Also to evaluate: a WP wrapper method around `ClipboardJS` as mentioned in
 #50322. Noting that also @xkon
 [https://core.trac.wordpress.org/ticket/44588#comment:23 mentioned] moving
 to `ClipboardJS` should still be a goal and at that time it was postponed
 to a future ticket yet to come. I'd reserve this attempt to a next
 iteration on this ticket.

 Aside: any reason why the privacy CSS is in the `edit.css` file?
 `common.css` seems more appropriate to me.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/50335#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list