Page MenuHomePhabricator

Links open in the current tab despite Ctrl+click or Shift+click
Closed, ResolvedPublic

Description

Current behavior: when Ctrl+clicking a link (for instance in the examples list) to open it in a new tab, it actually opens the example in the current tab, replacing the SPARQL request we might have been working on.

Expected behavior: mimic the default web pages behaviors:

  • Ctrl+click (or Cmd+click on Mac): open in a new tab (let the current page intact)
  • Shift+click: open in a new window (let the current page intact)

Possible reason this behave this way: you might be calling [preventDefault](https://developer.mozilla.org/en-US/docs/Web/API/Event/preventDefault) on all click events, in which case you need to filter-out events that correspond to an open outside click, see this [isOpenOutside](https://github.com/inventaire/inventaire-client/blob/8e3df86/app/lib/utils.coffee#L65-L83) filter function

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Smalyshev edited projects, added Wikidata Query UI; removed Wikidata-Query-Service.
Smalyshev subscribed.

when Ctrl+clicking a link (for instance in the examples list)

You mean in the examples dialog? For it to open the example in separate window would require to recreate the full environment in that window with different query. Probably possible, but not trivial.

yes, the examples dialog, but mostly the links to the example queries themselves: every layout that has the possibility to be built from the URL (so for example queries that would be https://query.wikidata.org/#[the serialized SPARQL]), should ideally offer the possibility to be open outside)

Use case: there is that SPARQL pattern I'm not totally familiar with, I want to browse 5 different examples at once to understand how it's used in example queries, so I will go in the examples list and Ctrl+click the 5 corresponding URLs in new tabs, giving me the possibility to easily switch between them with Ctrl+Tab. The current way to do that is to open 5 tabs, enter 5 times in the example list, filter 5 times the list to find the desired queries, and finally click the desired example query to make it load in the current page.

So you request to link the examples properly ( query.wikidata.org#Select.... ) instead of just # ?
This should be simple to change.

There is also a preview button for the query if that helps...

ooh I didn't see the preview button, but yes, just adding a href to query.wikidata.org#SELECT... URLs and not preventing default on click events when opened outside shouldn't be too hard(?) and of great value for tabs extensive users :)

Change 394871 had a related patch set uploaded (by Maxlath; owner: Maxlath):
[wikidata/query/gui@master] Let the browser handle click events with a modifier key on examples links so that the links can be open in a new tab or window

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

Jonas raised the priority of this task from Low to Needs Triage.Dec 4 2017, 9:05 AM
Jonas moved this task from Backlog to Doing on the Wikidata Query UI board.
Smalyshev triaged this task as Medium priority.Feb 12 2018, 8:07 AM

Change 394871 merged by jenkins-bot:
[wikidata/query/gui@master] Support opening examples in new tab or window

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