Skip to content

Commit 7a4fd81

Browse files
committed
Administration: Fix initial focus on the Add User page.
Removes code in `user-profile.js` that was originally meant to set initial focus to the password field in the reset password screen. The call to setting focus leaked on other pages, for example the Add User page, where setting initial focus to a field in the middle of the form is not desirable. The removed code was redundant anyways, as the reset password screen already comes with an inline script that takes care of initial focus. Developed in WordPress#12534 Props iamchitti, afercia. Fixes #65630. git-svn-id: https://develop.svn.wordpress.org/trunk@62764 602fd350-edb4-49c9-b593-d223f7449a82
1 parent d6b4669 commit 7a4fd81

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

src/js/_enqueues/admin/user-profile.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
originalFormContent,
2222
$passwordWrapper,
2323
successTimeout,
24-
isMac = window.navigator.platform ? window.navigator.platform.indexOf( 'Mac' ) !== -1 : false,
24+
isMac = window.navigator.platform ? window.navigator.platform.indexOf( 'Mac' ) !== -1 : false,
2525
ua = navigator.userAgent.toLowerCase(),
2626
isSafari = window.safari !== 'undefined' && typeof window.safari === 'object',
2727
isFirefox = ua.indexOf( 'firefox' ) !== -1;
@@ -59,11 +59,6 @@
5959

6060
// Once zxcvbn loads, passwords strength is known.
6161
$( '#pw-weak-text-label' ).text( __( 'Confirm use of weak password' ) );
62-
63-
// Focus the password field if not the install screen.
64-
if ( 'mailserver_pass' !== $pass1.prop('id' ) && ! $('#weblog_title').length ) {
65-
$( $pass1 ).trigger( 'focus' );
66-
}
6762
}
6863

6964
function bindPass1() {
@@ -407,7 +402,7 @@
407402
*
408403
* @param {KeyboardEvent} e The keydown event object.
409404
*
410-
* @return {boolean} True if Caps Lock is on, false otherwise.
405+
* @return {boolean} True if Caps Lock is on, false otherwise.
411406
*/
412407
function isCapsLockOn( event ) {
413408
return event.getModifierState( 'CapsLock' );

0 commit comments

Comments
 (0)