Fix tooltip for invert checkbox on Special:NewPages
authorumherirrender <umherirrender_de.wp@web.de>
Fri, 19 Jun 2015 15:45:23 +0000 (17:45 +0200)
committerUmherirrender <umherirrender_de.wp@web.de>
Fri, 19 Jun 2015 15:57:26 +0000 (15:57 +0000)
Tooltip has to be a 'name', not a parsed message,
because it goes through Linker::getTooltipAndAccessKey

Also propagate tooltip from the checkbox to the label to have a bigger
area for the mouse to trigger the tooltip. This is usally done for other
checkboxes on Special:Watchlist.

Follow-Up: I5c03dc543b910aab27a26a5a223341be50893cf3
Change-Id: If8dd9d66f57f63afe5df02d0d6b4cf70ba5d91c3

includes/htmlform/HTMLCheckField.php
includes/specials/SpecialNewpages.php

index 90293f4..dc2de65 100644 (file)
@@ -20,9 +20,15 @@ class HTMLCheckField extends HTMLFormField {
                        $attr['class'] = $this->mClass;
                }
 
+               $attrLabel = array( 'for' => $this->mID );
+               if ( isset( $attr['title'] ) ) {
+                       // propagate tooltip to label
+                       $attrLabel['title'] = $attr['title'];
+               }
+
                $chkLabel = Xml::check( $this->mName, $value, $attr )
                . '&#160;'
-               . Html::rawElement( 'label', array( 'for' => $this->mID ), $this->mLabel );
+               . Html::rawElement( 'label', $attrLabel, $this->mLabel );
 
                if ( $wgUseMediaWikiUIEverywhere || $this->mParent instanceof VFormHTMLForm ) {
                        $chkLabel = Html::rawElement(
index 899c736..4e8a3ab 100644 (file)
@@ -233,7 +233,7 @@ class SpecialNewpages extends IncludableSpecialPage {
                                'name' => 'invert',
                                'label-message' => 'invert',
                                'default' => $nsinvert,
-                               'tooltip' => $this->msg( 'tooltip-invert' )->text(),
+                               'tooltip' => 'invert',
                        ),
                        'tagFilter' => array(
                                'type' => 'tagfilter',