Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/js/_enqueues/admin/privacy-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,10 @@ jQuery( function( $ ) {
range = document.createRange();
$parent.addClass( 'hide-privacy-policy-tutorial' );

// Copy action.
range.selectNodeContents( $parent[0] );
// Copy action. Select only the dedicated copy-content wrapper
// so the actions toolbar (which contains the "Copied!" notice
// and button label) is never part of the selection - see #58969.
range.selectNodeContents( $parent.find( '.privacy-text-copy-content' )[0] );
window.getSelection().addRange( range );
document.execCommand( 'copy' );

Expand Down
10 changes: 6 additions & 4 deletions src/wp-admin/includes/class-wp-privacy-policy-content.php
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,12 @@ public static function privacy_policy_guide() {
</button>
</h4>
<div id="privacy-settings-accordion-block-<?php echo $i; ?>" class="privacy-settings-accordion-panel privacy-text-box-body" hidden="hidden">
<?php
echo $removed;
echo $section['policy_text'];
?>
<div class="privacy-text-copy-content">
<?php
echo $removed;
echo $section['policy_text'];
?>
</div>
<?php if ( empty( $section['removed'] ) ) : ?>
<div class="privacy-settings-accordion-actions">
<span class="success" aria-hidden="true"><?php _e( 'Copied!' ); ?></span>
Expand Down
Loading