Index: /trunk/src/js/_enqueues/admin/privacy-tools.js =================================================================== --- /trunk/src/js/_enqueues/admin/privacy-tools.js (revision 47571) +++ /trunk/src/js/_enqueues/admin/privacy-tools.js (revision 47572) @@ -260,8 +260,12 @@ }); - // Privacy policy page, copy button. + // Privacy Policy page, copy action. $( document ).on( 'click', function( event ) { - var $target = $( event.target ); - var $parent, $container, range; + var $parent, + $container, + range, + __ = wp.i18n.__, + $target = $( event.target ), + copiedNotice = $target.siblings( '.success' ); if ( $target.is( 'button.privacy-text-copy' ) ) { @@ -278,15 +282,21 @@ bodyPosition = document.body.scrollTop; + // Setup copy. window.getSelection().removeAllRanges(); + + // Hide tutorial content to remove from copied content. range = document.createRange(); $container.addClass( 'hide-privacy-policy-tutorial' ); + // Copy action. range.selectNodeContents( $container[0] ); window.getSelection().addRange( range ); document.execCommand( 'copy' ); + // Reset section. $container.removeClass( 'hide-privacy-policy-tutorial' ); window.getSelection().removeAllRanges(); + // Return scroll position - see #49540. if ( documentPosition > 0 && documentPosition !== document.documentElement.scrollTop ) { document.documentElement.scrollTop = documentPosition; @@ -294,4 +304,11 @@ document.body.scrollTop = bodyPosition; } + + // Display and speak notice to indicate action complete. + copiedNotice.addClass( 'visible' ); + wp.a11y.speak( __( 'The section has been copied to your clipboard.' ) ); + + // Delay notice dismissal. + setTimeout( function(){ copiedNotice.removeClass( 'visible' ); }, 3000 ); } catch ( er ) {} } Index: /trunk/src/wp-admin/css/edit.css =================================================================== --- /trunk/src/wp-admin/css/edit.css (revision 47571) +++ /trunk/src/wp-admin/css/edit.css (revision 47572) @@ -727,4 +727,16 @@ line-height: 2.46153846; padding-bottom: 6px; +} + +.privacy-text-actions .success { + display: none; + color: #40860a; + float: right; + padding-right: 1em; +} + +.privacy-text-actions .success.visible { + display: inline-block; + height: 32px; } Index: /trunk/src/wp-admin/includes/class-wp-privacy-policy-content.php =================================================================== --- /trunk/src/wp-admin/includes/class-wp-privacy-policy-content.php (revision 47571) +++ /trunk/src/wp-admin/includes/class-wp-privacy-policy-content.php (revision 47572) @@ -373,10 +373,7 @@ $content_array = self::get_suggested_policy_text(); - $content = ''; $toc = array( '
' . sprintf( $removed, $date ) . '