From 6679a0614db69424aa7aad65d1656b4fc1f43aa7 Mon Sep 17 00:00:00 2001 From: Jb Audras <audrasjb@git.wordpress.org> Date: Wed, 17 Nov 2021 00:12:35 +0000 Subject: [PATCH] Login and Registration: auto-focus the reset password field. Although auto-focusing form fields can be arguable in some cases, it makes sense when there is a very specific task to accomplish and when there is no relevant content before the auto-focused field. This change brings consistency between various forms generated by `wp-login.php`. Props afercia, donmhico, sabernhardt. Fixes #40302. git-svn-id: https://develop.svn.wordpress.org/trunk@52193 602fd350-edb4-49c9-b593-d223f7449a82 --- src/js/_enqueues/admin/user-profile.js | 3 +++ src/wp-login.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/js/_enqueues/admin/user-profile.js b/src/js/_enqueues/admin/user-profile.js index c2a403fe38..705bf8fb57 100644 --- a/src/js/_enqueues/admin/user-profile.js +++ b/src/js/_enqueues/admin/user-profile.js @@ -43,6 +43,9 @@ // Once zxcvbn loads, passwords strength is known. $( '#pw-weak-text-label' ).text( __( 'Confirm use of weak password' ) ); + + // Focus the password field. + $( $pass1 ).trigger( 'focus' ); } function bindPass1() { diff --git a/src/wp-login.php b/src/wp-login.php index 7dd2c19809..a0f36f5236 100644 --- a/src/wp-login.php +++ b/src/wp-login.php @@ -992,7 +992,7 @@ switch ( $action ) { </p> <?php - login_footer( 'user_pass' ); + login_footer( 'pass1' ); break; case 'register':