Bug 11890

Summary: Control-Click/Command-Click to open a link in a new tab not consistently working
Product: Koha Reporter: Ed Veal <edward.m.veal>
Component: Staff interfaceAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: chris, gmcharlt, gwilliams, jonathan.druart, nick, tomascohen
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=11937
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 10404    
Bug Blocks:    
Attachments: Bug 11890: Click events on titles does not work as expected
[SIGNED OFF] Bug 11890: Click events on titles does not work as expected
Bug 11890: Prevent default on click event
[PASSED QA] Bug 11890: Click events on titles does not work as expected
[PASSED QA] Bug 11890: Prevent default on click event

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 (kidclamp) 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 (kidclamp) 2015-04-24 20:55:54 UTC Comment hidden (obsolete)
Comment 5 Nick Clemens (kidclamp) 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 (tcohen) 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