Special:Contribs: autofocus to 'target' if target hasn't been specified or in non...
authorGlaisher <glaisher.wiki@gmail.com>
Thu, 12 Nov 2015 05:15:40 +0000 (10:15 +0500)
committerGlaisher <glaisher.wiki@gmail.com>
Sun, 29 Nov 2015 05:44:26 +0000 (10:44 +0500)
Target field doesn't work in newbies mode so users doesn't need to enter in that field
newbies mode also. This is not a huge issue normally but annoying when you're on a tablet
or mobile where the autofocus makes the screen keyboard be shown when you visit the page.

Bug: T117397
Change-Id: Ic6fd2fb2421325f748fccb2a5432e7713d0dcbb0

includes/specials/SpecialContributions.php

index 81668e1..5f7c587 100644 (file)
@@ -517,8 +517,13 @@ class SpecialContributions extends IncludableSpecialPage {
                                        'mw-ui-input-inline',
                                        'mw-autocomplete-user', // used by mediawiki.userSuggest
                                ),
-                       ) + ( $this->opts['target'] ? array() : array( 'autofocus' ) )
+                       ) + (
+                               // Only autofocus if target hasn't been specified or in non-newbies mode
+                               ( $this->opts['contribs'] === 'newbie' || $this->opts['target'] )
+                                       ? array() : array( 'autofocus' => true )
+                               )
                );
+
                $targetSelection = Html::rawElement(
                        'td',
                        array( 'colspan' => 2 ),