Special:Search Don't autofocus search bar unless it is empty
authorNamit <namit.ohri@gmail.com>
Wed, 17 Dec 2014 06:01:04 +0000 (11:31 +0530)
committerUmherirrender <umherirrender_de.wp@web.de>
Tue, 23 Dec 2014 17:45:12 +0000 (17:45 +0000)
This interferes with scrolling through the results using the arrow keys.The user would first
have to defocus the text box by clicking outside it or pressing Tab.

Bug: T78637
Change-Id: Ic88e70c8e2308797b39c707984d77405369ae46c

RELEASE-NOTES-1.25
includes/specials/SpecialSearch.php

index 00bc155..77dc55b 100644 (file)
@@ -115,6 +115,7 @@ production.
    and MovePage::checkPermissions().
 * The Special:WhatLinksHere page linked from 'Number of redirects to this page'
   on action=info about a file page does not list file links anymore.
+* (T78637) Search bar is not autofocused unless it is empty so that proper scrolling using arrow keys is possible.
 
 === Action API changes in 1.25 ===
 * (T67403) XML tag highlighting is now only performed for formats
index a7dea88..031dbd7 100644 (file)
@@ -1064,7 +1064,7 @@ class SpecialSearch extends SpecialPage {
                $out .= Html::input( 'search', $term, 'search', array(
                        'id' => $this->profile === 'advanced' ? 'powerSearchText' : 'searchText',
                        'size' => '50',
-                       'autofocus',
+                       'autofocus' => trim( $term ) === '',
                        'class' => 'mw-ui-input mw-ui-input-inline',
                ) ) . "\n";
                $out .= Html::hidden( 'fulltext', 'Search' ) . "\n";