Page MenuHomePhabricator

Special:ComparePages should use AJAX suggestions
Closed, ResolvedPublic

Description

Self-explanatory. Just like the search bar.


Version: 1.17.x
Severity: enhancement

Details

Reference
bz24235

Event Timeline

bzimport raised the priority of this task from to Low.
bzimport set Reference to bz24235.
bzimport added a subscriber: Unknown Object (MLST).
MaxSem created this task.Jul 2 2010, 2:52 PM
MZMcBride set Security to None.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 24 2015, 8:49 AM

The following patch worked for me:

diff --git a/includes/specials/SpecialComparePages.php b/includes/specials/SpecialComparePages.php
index da1a54c..276a68d 100644
--- a/includes/specials/SpecialComparePages.php
+++ b/includes/specials/SpecialComparePages.php
@@ -49,11 +49,13 @@ class SpecialComparePages extends SpecialPage {
        public function execute( $par ) {
                $this->setHeaders();
                $this->outputHeader();
+               $this->getOutput()->addModules( 'mediawiki.searchSuggest' );

                $form = new HTMLForm( array(
                        'Page1' => array(
                                'type' => 'text',
                                'name' => 'page1',
+                               'id' => 'searchInput',
                                'label-message' => 'compare-page1',
                                'size' => '40',
                                'section' => 'page1',
@@ -70,6 +72,7 @@ class SpecialComparePages extends SpecialPage {
                        'Page2' => array(
                                'type' => 'text',
                                'name' => 'page2',
+                               'id' => 'searchInput',
                                'label-message' => 'compare-page2',
                                'size' => '40',
                                'section' => 'page2',

It, however shows up like this:

Do we want the "containing..." box to show up, and shouldn't the rest of the box be styled like mediawiki.userSuggest? mediawiki.userSuggest's box has a bigger font-size, for example. And - when I click on a name (e.g. "Meta:Administrators"), the browser refreshes the page completely (it puts the name in the correct box too, though).

Is there some alternative for mediawiki.searchSuggest that suits this?

You should use 'class' => 'mw-searchInput' instead of 'id' => 'searchInput' and it should be fine (see the code of Special:WhatLinksHere for an example). 'id' => 'searchInput' is reserved for the primary search box of the skin (top-right in Vector, sidebar in MonoBook, elsewhere in other skins) and, as you noticed, it provides some additional behaviors.

Change 234306 had a related patch set uploaded (by Southparkfan):
Enable autocompletion for Special:ComparePages

https://gerrit.wikimedia.org/r/234306

Umherirrender closed this task as Resolved.Aug 27 2015, 6:09 PM
Umherirrender assigned this task to Southparkfan.
Umherirrender removed a subscriber: wikibugs-l-list.

Change 234306 merged by jenkins-bot:
Enable autocompletion for Special:ComparePages

https://gerrit.wikimedia.org/r/234306