diff --git a/src/js/_enqueues/admin/user-profile.js b/src/js/_enqueues/admin/user-profile.js
index 54215c7b42..99e5a0c0e4 100644
a
|
b
|
|
7 | 7 | var updateLock = false, |
8 | 8 | isSubmitting = false, |
9 | 9 | __ = wp.i18n.__, |
| 10 | clipboard = new ClipboardJS( '.application-password-display .copy-button' ), |
10 | 11 | $pass1Row, |
11 | 12 | $pass1, |
12 | 13 | $pass2, |
… |
… |
|
18 | 19 | currentPass, |
19 | 20 | $form, |
20 | 21 | originalFormContent, |
21 | | $passwordWrapper; |
| 22 | $passwordWrapper, |
| 23 | successTimeout; |
22 | 24 | |
23 | 25 | function generatePassword() { |
24 | 26 | if ( typeof zxcvbn !== 'function' ) { |
… |
… |
|
346 | 348 | } |
347 | 349 | } |
348 | 350 | |
| 351 | // Debug information copy section. |
| 352 | clipboard.on( 'success', function( e ) { |
| 353 | var triggerElement = $( e.trigger ), |
| 354 | successElement = $( '.success', triggerElement.closest( '.application-password-display' ) ); |
| 355 | |
| 356 | // Clear the selection and move focus back to the trigger. |
| 357 | e.clearSelection(); |
| 358 | |
| 359 | // Show success visual feedback. |
| 360 | clearTimeout( successTimeout ); |
| 361 | successElement.removeClass( 'hidden' ); |
| 362 | |
| 363 | // Hide success visual feedback after 3 seconds since last success. |
| 364 | successTimeout = setTimeout( function() { |
| 365 | successElement.addClass( 'hidden' ); |
| 366 | }, 3000 ); |
| 367 | |
| 368 | // Handle success audible feedback. |
| 369 | wp.a11y.speak( __( 'Site information has been copied to your clipboard.' ) ); |
| 370 | } ); |
| 371 | |
349 | 372 | $( function() { |
350 | 373 | var $colorpicker, $stylesheet, user_id, current_user_id, |
351 | 374 | select = $( '#display_name' ), |
diff --git a/src/wp-admin/css/common.css b/src/wp-admin/css/common.css
index 17d9493161..5e623df062 100644
a
|
b
|
a#remove-post-thumbnail:hover, |
916 | 916 | border: none; |
917 | 917 | } |
918 | 918 | |
| 919 | .application-password-display .success { |
| 920 | color: #007017; |
| 921 | margin-left: 0.5rem; |
| 922 | } |
| 923 | |
919 | 924 | /*------------------------------------------------------------------------------ |
920 | 925 | 3.0 - Actions |
921 | 926 | ------------------------------------------------------------------------------*/ |
diff --git a/src/wp-admin/user-edit.php b/src/wp-admin/user-edit.php
index 860a0a6e07..92f32ad198 100644
a
|
b
|
switch ( $action ) { |
984 | 984 | ?> |
985 | 985 | </label> |
986 | 986 | <input id="new-application-password-value" type="text" class="code" readonly="readonly" value="{{ data.password }}" /> |
| 987 | <button type="button" class="button copy-button" data-clipboard-text="{{ data.password }}">copy</button> |
| 988 | <span class="success hidden" aria-hidden="true"><?php _e( 'Copied!' ); ?></span> |
987 | 989 | </p> |
988 | 990 | <p><?php _e( 'Be sure to save this in a safe location. You will not be able to retrieve it.' ); ?></p> |
989 | 991 | <button type="button" class="notice-dismiss"> |
diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php
index c9eb40d1c5..3dc601d5cd 100644
a
|
b
|
function wp_default_scripts( $scripts ) { |
1217 | 1217 | $scripts->add( 'auth-app', "/wp-admin/js/auth-app$suffix.js", array( 'jquery', 'wp-api-request', 'wp-i18n', 'wp-hooks' ), false, 1 ); |
1218 | 1218 | $scripts->set_translations( 'auth-app' ); |
1219 | 1219 | |
1220 | | $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter', 'wp-util' ), false, 1 ); |
| 1220 | $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'clipboard', 'jquery', 'password-strength-meter', 'wp-util', 'wp-a11y' ), false, 1 ); |
1221 | 1221 | $scripts->set_translations( 'user-profile' ); |
1222 | 1222 | $user_id = isset( $_GET['user_id'] ) ? (int) $_GET['user_id'] : 0; |
1223 | 1223 | did_action( 'init' ) && $scripts->localize( |