jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/349261 )

Change subject: Search button should not be wrapped in a link
......................................................................


Search button should not be wrapped in a link

This looks like an artifact of the old search form. The problem with
using both a link and a submit icon, is that in certain browsers
the link may be followed
rather than the submit.

Clicking the search icon submit button will have the same effect as
clicking the link - it will submit with an empty search query.

There is however no need to include the submit button.
Without JS, the link will take the user to the search form.

With JS, hitting enter is what submits the form which happens
even if it is omitted.

Also add method to form to avoid ambiguity.

Bug: T140490
Bug: T163049
Change-Id: Ide7725dff259596c963542a0171a78f38ed7e038
---
M includes/skins/MinervaTemplate.php
M includes/skins/minerva.mustache
M resources/skins.minerva.base.styles/ui.less
3 files changed, 8 insertions(+), 22 deletions(-)

Approvals:
  Pmiazga: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/skins/MinervaTemplate.php 
b/includes/skins/MinervaTemplate.php
index 2465e63..0a2da33 100644
--- a/includes/skins/MinervaTemplate.php
+++ b/includes/skins/MinervaTemplate.php
@@ -262,9 +262,6 @@
                $templateParser = new TemplateParser( __DIR__ );
 
                // prepare template data
-               $input = Html::element( 'input',
-                       [ 'type' => 'submit', 'value' => wfMessage( 
'searchbutton' ) ]
-               );
                $templateData = [
                        'banners' => $data['banners'],
                        'wgScript' => $data['wgScript'],
@@ -274,11 +271,15 @@
                        'headelement' => $data[ 'headelement' ],
                        'menuButton' => $data['menuButton'],
                        'headinghtml' => $data['footer-site-heading-html'],
-                       'searchButton' => Html::rawElement( 'a', [
-                               'href' => SpecialPage::getTitleFor( 'Search' 
)->getLocalURL(),
+                       // A button when clicked will submit the form
+                       // This is used so that on tablet devices with JS 
disabled the search button
+                       // passes the value of input to the search
+                       // We avoid using input[type=submit] as these cannot be 
easily styled as mediawiki ui icons
+                       // which is problematic in Opera Mini (see T140490)
+                       'searchButton' => Html::rawElement( 'button', [
                                'id' => 'searchIcon',
                                'class' => MobileUI::iconClass( 
'magnifying-glass', 'element' ),
-                       ], $input ),
+                       ], wfMessage( 'searchbutton' ) ),
                        'secondaryButtonData' => $data['secondaryButtonData'],
                        'mainmenuhtml' => $this->getMainMenuHtml( $data ),
                        'contenthtml' => $this->getContentWrapperHtml( $data ),
diff --git a/includes/skins/minerva.mustache b/includes/skins/minerva.mustache
index 2ac61d8..b082526 100644
--- a/includes/skins/minerva.mustache
+++ b/includes/skins/minerva.mustache
@@ -9,7 +9,7 @@
                        {{>banners}}
                </div>
                <div class="header-container header-chrome">
-                       <form class="header" action="{{wgScript}}">
+                       <form class="header" action="{{wgScript}}" method="get">
                                <div>{{{menuButton}}}</div>
                                <div class="branding-box">
                                        <h1>
diff --git a/resources/skins.minerva.base.styles/ui.less 
b/resources/skins.minerva.base.styles/ui.less
index 6dbc7ee..adb6071 100644
--- a/resources/skins.minerva.base.styles/ui.less
+++ b/resources/skins.minerva.base.styles/ui.less
@@ -31,21 +31,6 @@
        }
 }
 
-#searchIcon {
-       input {
-               position: absolute;
-               top: 0;
-               left: 0;
-               right: 0;
-               bottom: 0;
-               color: transparent;
-
-               &:focus {
-                       outline: none;
-               }
-       }
-}
-
 .last-modified-bar {
        background-color: transparent;
        display: block;

-- 
To view, visit https://gerrit.wikimedia.org/r/349261
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ide7725dff259596c963542a0171a78f38ed7e038
Gerrit-PatchSet: 5
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: Bmansurov <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: Jhernandez <[email protected]>
Gerrit-Reviewer: Phuedx <[email protected]>
Gerrit-Reviewer: Pmiazga <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to