Page MenuHomePhabricator

SimpleSearch should use native event handling (open link in or submit form to a new tab)
Closed, ResolvedPublic

Description

Tested in Opera.

Shift + Enter does not work to popup a wiki search in a new browser page or tab on WMF sites. I think it's because of the Vector extension's changes the search box. I've lost a lot of work on Wikipedia when I try to find a cite or other info, and then the Vector search box causes my browser to leave my work unsaved, and lost forever.

This seems to be related, but describes slightly different phenomena for a different extension:

https://bugzilla.wikimedia.org/show_bug.cgi?id=23866


Version: unspecified
Severity: major
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=23866

Details

Reference
bz34756

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 12:18 AM
bzimport set Reference to bz34756.

This is browser specific behavior as far as I can tell. For instance, here on bugzilla, a similarly styled search box doesn't open a new window in FF, but does in Opera on shift-enter.

But, you're right, the behavior is different in opera on enwiki. Since I can see this on enwiki, it definitely isn't a 1.19 problem.

My guess is this is to do with the code around here: http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/resources/jquery/jquery.suggestions.js?view=markup#l492

If the search box is visible when you hit enter that code does and runs preventDefault, likely killing Opera's feature. My guess is the intent was to capture enters that are pressed when one of the suggestion entries are given, but it isn't looking for the actual case when they are actually selected like it should be.

Chrome is affected too. There may be other browsers with issues also. I tested MSIE, but it does not seem to have the shift + enter feature.

Bug 23866 was just closed by me. It reports a similar issue that is apparently specific to a now-obsolete version of Opera. However, I tested this bug again with Opera 12.00, Google Chrome 19.0.1084.56 m, and whatever random browsers I had sitting around, and I'm certain it is a problem with Vector, not the browsers.

I also decided to upgrade this bug to "major" because it unexpectedly causes loss of work when editors try to check their facts with a Wikipedia search.

Vector 0.3.0 at Wikipedia is the version I tested again today.

If you are interested, there is a JavaScript import to open search in a new tab via Ctrl-click (PC) and Command-click (Mac). The Command key is the Apple key on Apple keyboards. See:
http://commons.wikimedia.org/wiki/User_talk:Timeshifter/Open_search_in_new_tab.js

A related feature request is bug 35974. Preference or default setting to open search results and suggestions in new tab.

Change 48252 had a related patch set uploaded by Bartosz Dziewoński:
jquery.suggestions, mediawiki.searchSuggest: Fix form submission

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

Change 48252 merged by jenkins-bot:
jquery.suggestions, mediawiki.searchSuggest: Fix form submission

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

This should work now (the fix is not deployed on Wikimedia wikis yet). Please report any problems that might seem related. :)