Bug 11890 - Control-Click/Command-Click to open a link in a new tab not consistently working
Summary: Control-Click/Command-Click to open a link in a new tab not consistently working
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff Client (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Whiteboard:
Keywords:
Depends on: 10404
Blocks:
  Show dependency treegraph
 
Reported: 2014-03-04 15:12 UTC by Ed Veal
Modified: 2015-12-03 22:02 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 11890: Click events on titles does not work as expected (2.38 KB, patch)
2015-04-24 10:19 UTC, Jonathan Druart
Details | Diff | Splinter Review
[SIGNED OFF] Bug 11890: Click events on titles does not work as expected (2.45 KB, patch)
2015-04-24 20:55 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 11890: Prevent default on click event (1.25 KB, patch)
2015-04-29 07:47 UTC, Jonathan Druart
Details | Diff | Splinter Review
[PASSED QA] Bug 11890: Click events on titles does not work as expected (2.50 KB, patch)
2015-05-03 16:54 UTC, Katrin Fischer
Details | Diff | Splinter Review
[PASSED QA] Bug 11890: Prevent default on click event (1.32 KB, patch)
2015-05-03 16:55 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Veal 2014-03-04 15:12:42 UTC
Control-Click (PC) or Command-Click normally opens any link in a web browser into a new tab.

After the 3.14 upgrade, we have discovered inconsistency in links not always having this behavior anymore on search.pl and detail.pl.  This has been replicated on Master as well. 

On search.pl, control-clicking or command-clicking on the title links opens the link in the same window. You have to actually right-click on the link and tell the browser to open the link in a new tab. The linked author field in the search results, the call numbers, the facets on the left-hand side of the screen, the links at the top -- all will open in a new tab with the control-click or command-click option. 

On detail.pl, if the back to search results/next record/previous record links are present, control-clicking or command-clicking the normal/MARC/ISBD/Items/Holds/Checkout History/Barcode links open the information on the same screen. If you switch to one of the other tabs, the back to search results link is gone, and this keyboard shortcut works again. 

I do not see this same behavior in the OPAC. 

Disabling all javascript causes it to return to normal.
Comment 1 Owen Leonard 2014-05-20 16:00:57 UTC
(In reply to Ed Veal from comment #0)

> On search.pl, control-clicking or command-clicking on the title links opens
> the link in the same window.

How do you reproduce this problem? I'm not seeing it in master using Firefox.

> Disabling all javascript causes it to return to normal.

This would imply that a JavaScript error on the page is to blame. Does your browser report any JavaScript errors?
Comment 2 Nick Clemens 2015-01-31 18:09:43 UTC
On a fresh Ubuntu package install of 3.18.3 and on a fresh kohadevbox I imported two records from LOC (Beyond Lies the Wub and Ubik, both by Philip K Dick)

Rebuild zebra

search for "Philip" 

Control+clicking title in search results opens in current tab in Firefox and Chrome, all other links on the page open in a new tab on control+click


The only javascript error I see is an Uncaught TypeError: undefined is not a function
Comment 3 Jonathan Druart 2015-04-24 10:19:16 UTC Comment hidden (obsolete)
Comment 4 Nick Clemens 2015-04-24 20:55:54 UTC Comment hidden (obsolete)
Comment 5 Nick Clemens 2015-04-24 20:56:54 UTC
> Note that this patch is not perfect, it fixes the 2 bad behaviors but
> the ctrl+click gives the focus to the new tab (could go against the
> preferences of the users).

This is a huge improvement so signing off, would it seem ungrateful to file the above as a new bug?
Comment 6 Jonathan Druart 2015-04-27 07:55:04 UTC
(In reply to Nick Clemens from comment #5)
> > Note that this patch is not perfect, it fixes the 2 bad behaviors but
> > the ctrl+click gives the focus to the new tab (could go against the
> > preferences of the users).
> 
> This is a huge improvement so signing off, would it seem ungrateful to file
> the above as a new bug?

Not at all, feel free to do it :)
Comment 7 Katrin Fischer 2015-04-29 05:52:47 UTC
I am sorry, but this doesn't seem to work correctly:

Without patch:
- Search for something
- From the result list, click on any record
- Verify the result browser is shown on the left

With patch:
- Search for the same something as above
- From result list, click on the same record
- Verify the result browser is missing
Comment 8 Jonathan Druart 2015-04-29 07:47:01 UTC Comment hidden (obsolete)
Comment 9 Jonathan Druart 2015-04-29 07:48:13 UTC
(In reply to Katrin Fischer from comment #7)
> I am sorry, but this doesn't seem to work correctly:
> 
> Without patch:
> - Search for something
> - From the result list, click on any record
> - Verify the result browser is shown on the left
> 
> With patch:
> - Search for the same something as above
> - From result list, click on the same record
> - Verify the result browser is missing

Good to have a QA step :)
Sorry about that, I am sure I tested this case, the trivial one! (but it seems not with this code...)
Comment 10 Katrin Fischer 2015-04-29 22:15:53 UTC
OPAC view: Open in new window. still opens in the same tab for me :(
Comment 11 Jonathan Druart 2015-04-30 07:31:19 UTC
(In reply to Katrin Fischer from comment #10)
> OPAC view: Open in new window. still opens in the same tab for me :(

Please detail, what does not work? Clicking on what and how (middle click, left click, ctrl+click)?
I confirm it works here.
Comment 12 Katrin Fischer 2015-04-30 07:36:51 UTC
After sleeping over it, I think it might be out of scope of the bug.
But there is another bug related to the link rewriting: If you set your OpacBaseUrl we display a link to the OPAC in the details page, that opens in a new tab by default - but currently this doesn't work.
Comment 13 Katrin Fischer 2015-05-03 16:54:48 UTC
Created attachment 38782 [details] [review]
[PASSED QA] Bug 11890: Click events on titles does not work as expected

The browse results feature (bug 10404) modified the click events on
titles on the search result page (intranet).

It introduced bad behaviors:
1/ ctrl+click on a title does not open a new tab
2/ middle click on a title does open a new tab but the browser is not
displayed.

Note that this patch is not perfect, it fixes the 2 bad behaviors but
the ctrl+click gives the focus to the new tab (could go against the
preferences of the users).

Test plan:
1/ On the staff interface, launch a search (catalogue/search.pl?q=XXX)
2/ When middle-clicking on a title, a new tab should open. On this tab
the browse result feature should be displayed
3/ Same for cltr+click

Signed-off-by: Nick Clemens <nick@quecheelibrary.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 14 Katrin Fischer 2015-05-03 16:55:04 UTC
Created attachment 38783 [details] [review]
[PASSED QA] Bug 11890: Prevent default on click event

It seems that the previous patch does not stop the propagation of the
event if the link is clicked with the left button (which=1).

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 15 Katrin Fischer 2015-05-03 16:55:36 UTC
Improves behaviour, but there are still some problems:

- left click open in new tab is missing the browser
Comment 16 Tomás Cohen Arazi 2015-05-07 15:35:58 UTC
Patches pushed to master.

Thanks Jonathan!
Comment 17 Chris Cormack 2015-05-17 06:54:17 UTC
Pushed to 3.18.x will be in 3.18.7