Discussion:
[Bug 58467] New: Wrong smart keyword on Wikidata
b***@wikimedia.org
2013-12-13 22:03:44 UTC
Permalink
https://bugzilla.wikimedia.org/show_bug.cgi?id=58467

Web browser: ---
Bug ID: 58467
Summary: Wrong smart keyword on Wikidata
Product: MediaWiki extensions
Version: master
Hardware: All
OS: All
Status: NEW
Keywords: javascript
Severity: normal
Priority: Unprioritized
Component: DataValues
Assignee: wikibugs-***@lists.wikimedia.org
Reporter: ***@googlemail.com
CC: ***@yahoo.com,
wikidata-***@lists.wikimedia.org
Classification: Unclassified
Mobile Platform: ---

Firefox generates smart keywords from a search bar:
https://support.mozilla.org/en-US/kb/how-search-from-address-bar

On Wikidata it generates the wrong bookmark
https://www.wikidata.org/w/index.php?=%s&search=&title=Special%3ASearch

Expected bookmark is
https://www.wikidata.org/w/index.php?search=%s&title=Special%3ASearch

The reason is in the JavaScript code. The original HTML from server is

<form action="/w/index.php" id="searchform">
<div id="simpleSearch">
<input name="search" placeholder="Search" title="Search Wikidata [f]"
accesskey="f" id="searchInput" />
<button type="submit" name="button" title="Search the pages for this
text" id="searchButton">
<img
src="//bits.wikimedia.org/static-1.23wmf6/skins/vector/images/search-ltr.png?303-4"
alt="Search" width="12" height="13" />
</button>
<input type='hidden' name="title" value="Special:Search"/>
</div>
</form>

JavaScript converts this the following HTML code with a duplicate <input>
element:

<form id="searchform" action="/w/index.php">
<div id="simpleSearch">
<input id="searchInput" accesskey="f" title="Search Wikidata
[alt-shift-f]" placeholder="Search" class="ui-autocomplete-input
ui-suggester-input ui-entityselector-input" autocomplete="off" role="textbox"
aria-autocomplete="list" aria-haspopup="true" tabindex="1">
<input type="hidden" name="search" value="">
<button id="searchButton" title="Search the pages for this text"
name="button" type="submit">
<img width="12" height="13" alt="Search"
src="//bits.wikimedia.org/static-1.23wmf6/skins/vector/images/search-ltr.png?303-4">
</button>
<input type="hidden" value="Special:Search" name="title">
</div>
</form>

The JavaScript code on www.mediawiki.org works and converts the HTML to

<form id="searchform" action="/w/index.php">
<div id="improvedsearch-toggle" class="vectorMenu" title="Wikimedia tech"
style="width: 20px; height: 1.3em; margin-left: 14.5em; margin-right:
-0.8em;"></div>
<div id="simpleSearch">
<input id="searchInput" accesskey="f" title="Search MediaWiki
[alt-shift-f]" placeholder="Search" name="search" tabindex="1"
autocomplete="off">
<button id="searchButton" title="Search the pages for this text"
name="button" type="submit">
<img width="12" height="13" alt="Search"
src="//bits.wikimedia.org/static-1.23wmf7/skins/vector/images/search-ltr.png?303-4">
</button>
<input type="hidden" value="Special:Search" name="title">
</div>
</form>
--
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
b***@wikimedia.org
2013-12-16 10:27:01 UTC
Permalink
https://bugzilla.wikimedia.org/show_bug.cgi?id=58467

Lydia Pintscher <***@wikimedia.de> changed:

What |Removed |Added
----------------------------------------------------------------------------
Priority|Unprioritized |Normal
CC| |***@wikimedia.de
| |,
| |***@wikimedia.d
| |e
Component|DataValues |WikidataClient
Assignee|wikibugs-***@lists.wikimedia. |wikidata-***@lists.wikimed
|org |ia.org
Severity|normal |minor
--
You are receiving this mail because:
You are the assignee for the bug.
You are on the CC list for the bug.
b***@wikimedia.org
2014-11-19 10:19:34 UTC
Permalink
https://bugzilla.wikimedia.org/show_bug.cgi?id=58467

Lydia Pintscher <***@wikimedia.de> changed:

What |Removed |Added
----------------------------------------------------------------------------
Keywords| |need-volunteer
Priority|Normal |Low
Whiteboard| |u=dev c=frontend p=0
--
You are receiving this mail because:
You are on the CC list for the bug.
b***@wikimedia.org
2014-11-19 10:43:19 UTC
Permalink
https://bugzilla.wikimedia.org/show_bug.cgi?id=58467

--- Comment #1 from Thiemo Mättig <***@wikimedia.de> ---
Oh, wow. This is clearly a bug in Firefox. You know that, right? Not that we
shouldn't work around it. We should.

I had two ideas:

1.) Switch the order of the two <input>, the named hidden <input> first, our
unnamed <input> after.
Result: .../index.php?search=&=%s&title=Spezial%3ASuche

2.) Give both <input> the same name="search".
Result: .../index.php?search=%s&search=&title=Spezial%3ASuche
Dang, this overrides the user's input with an empty string.

3.) Do both. Works.
--
You are receiving this mail because:
You are on the CC list for the bug.
b***@wikimedia.org
2014-11-19 10:44:29 UTC
Permalink
https://bugzilla.wikimedia.org/show_bug.cgi?id=58467

--- Comment #2 from Gerrit Notification Bot <***@wikimedia.org> ---
Change 174387 had a related patch set uploaded by Thiemo Mättig (WMDE):
Fix entitysearch to support Firefox smart keyword

https://gerrit.wikimedia.org/r/174387
--
You are receiving this mail because:
You are on the CC list for the bug.
b***@wikimedia.org
2014-11-19 10:44:32 UTC
Permalink
https://bugzilla.wikimedia.org/show_bug.cgi?id=58467

Gerrit Notification Bot <***@wikimedia.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |PATCH_TO_REVIEW
--
You are receiving this mail because:
You are on the CC list for the bug.
b***@wikimedia.org
2014-11-20 10:41:09 UTC
Permalink
https://bugzilla.wikimedia.org/show_bug.cgi?id=58467

--- Comment #3 from Fomafix <***@googlemail.com> ---
There is not bug in Firefox. It converts the <input>s in the form to a query
string like in HTML. The reason are the two <input>s. Why are there two
<input>s? They seams to be redundant. The implementation on mediawiki.org works
with one <input>.
--
You are receiving this mail because:
You are on the CC list for the bug.
b***@wikimedia.org
2014-11-20 12:45:08 UTC
Permalink
https://bugzilla.wikimedia.org/show_bug.cgi?id=58467

--- Comment #4 from Thiemo Mättig <***@wikimedia.de> ---
Turning an unnamed input into index.php?=%s is clearly a bug in Firefox. I'm
not aware of a server side language that supports unnames GET variables. In PHP
that would be $_GET['']. I just tried that just to be sure and no, PHP doesn't
support this.

Again, this doesn't mean we should not work around this issue. See my patch.
--
You are receiving this mail because:
You are on the CC list for the bug.
b***@wikimedia.org
2014-11-20 22:50:02 UTC
Permalink
https://bugzilla.wikimedia.org/show_bug.cgi?id=58467

--- Comment #5 from Fomafix <***@googlemail.com> ---
Ok, an <input> without name is ignored in the normal transformation from a
<form> to a query string. Here has the <input> for which the smart keyword is
requested no name. When this <input> get omitted the query string for the smart
keyword would have no %s. ?=%s is a comprehensible query string for the smart
keyword on a <input> without a name.

Generating two <input>s with the same name is a bad solution for this problem.
The right solution is to combine the two <input>s to one <input>.
--
You are receiving this mail because:
You are on the CC list for the bug.
Loading...