Privacy: Print screen reader text for the "Copy suggested policy text..." action button.

This change switches out sprintf for printf on the "Copy suggested policy text from..." button screen reader text. Also, wrap the actual button text in a <span aria-hidden="true"> to prevent both the button text and the screen reader text from being spoken.

Props mukesh27, SergeyBiryukov, sabernhardt, desrosj.
Merges [50585] to the 5.7 branch.
Fixes #52891.

git-svn-id: https://develop.svn.wordpress.org/branches/5.7@50609 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
David Baumwald 2021-03-26 20:30:56 +00:00
parent 17805ecf86
commit 8292e72a5b

View File

@ -420,11 +420,11 @@ final class WP_Privacy_Policy_Content {
<div class="privacy-settings-accordion-actions">
<span class="success" aria-hidden="true"><?php _e( 'Copied!' ); ?></span>
<button type="button" class="privacy-text-copy button">
<?php _e( 'Copy suggested policy text to clipboard' ); ?>
<span aria-hidden="true"><?php _e( 'Copy suggested policy text to clipboard' ); ?></span>
<span class="screen-reader-text">
<?php
/* translators: %s: Plugin name. */
sprintf( __( 'Copy suggested policy text from %s.' ), $plugin_name );
printf( __( 'Copy suggested policy text from %s.' ), $plugin_name );
?>
</span>
</button>