Page MenuHomePhabricator

Special:ComparePages should use AJAX suggestions
Closed, ResolvedPublic


Self-explanatory. Just like the search bar.

Version: 1.17.x
Severity: enhancement

Event Timeline

bzimport raised the priority of this task from to Low.Nov 21 2014, 11:11 PM
bzimport set Reference to bz24235.
bzimport added a subscriber: Unknown Object (MLST).

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->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:

bugdingen.png (409×439 px, 11 KB)

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

Umherirrender assigned this task to Southparkfan.
Umherirrender removed a subscriber: wikibugs-l-list.

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