From debacfbb37f08aed56f42ca3c73e70c328209d05 Mon Sep 17 00:00:00 2001 From: umherirrender Date: Mon, 30 Nov 2015 19:44:26 +0100 Subject: [PATCH] Do not set autofocus for valid target input on Special:UserRights When open Special:UserRights with a valid user as target, there is no need to set the autofocus on the input field. Just set it on blank input and error input (such as non existing user or ip). Change-Id: I14b005b83adbbd899d2846c8d71cbfb1a1a25ad7 --- includes/specials/SpecialUserrights.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/specials/SpecialUserrights.php b/includes/specials/SpecialUserrights.php index a6fe1b5a12..1327972e66 100644 --- a/includes/specials/SpecialUserrights.php +++ b/includes/specials/SpecialUserrights.php @@ -458,8 +458,10 @@ class UserrightsPage extends SpecialPage { 30, str_replace( '_', ' ', $this->mTarget ), array( - 'autofocus' => '', 'class' => 'mw-autocomplete-user', // used by mediawiki.userSuggest + ) + ( + // Set autofocus on blank input and error input + $this->mFetchedUser === null ? array( 'autofocus' => '' ) : array() ) ) . ' ' . Xml::submitButton( $this->msg( 'editusergroup' )->text() ) . -- 2.20.1