Do not set autofocus for valid target input on Special:UserRights
authorumherirrender <umherirrender_de.wp@web.de>
Mon, 30 Nov 2015 18:44:26 +0000 (19:44 +0100)
committerumherirrender <umherirrender_de.wp@web.de>
Mon, 30 Nov 2015 18:44:26 +0000 (19:44 +0100)
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

index a6fe1b5..1327972 100644 (file)
@@ -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() ) .