jbrowse
jbrowse copied to clipboard
onclick handler with newWindow action opens two windows in FireFox
I'm using JBrowse 1.11.4, with FireFox 31. I have a set of CanvasFeatures tracks with a custom onclick handler that looks like:
"onClick" : {
"action" : "newWindow",
"url" : "function(track,feature,div) {return feature.data.url;}"
},
When I click on the element in FireFox, two new windows are always opened, both pointing to the corresponding feature's URL. I expected only one new window to be opened.
In Chrome, sometimes one window is opened, sometimes two are opened. But in FireFox, I always get two windows.
Can you try clearing the cache on firefox? I think i have seen this before and then clearing the cache made it go away somehow.
Clearing the cache fixed the problem on both browsers. Thanks!
I'm going to reopen this, as we still see this problem, even with cleared cache.
I added a console.log call for the URL, to src/JBrowse/View/Track/BlockBased.js at line 805 in my dev checkout of v1.11.4. From: window.open( url, '_blank' ); To: { console.log("clicked "+url); window.open( url, '_blank' ); }
We see the console message twice, as shown in this screenshot, but the bad behavior is very intermittent and maddeningly hard to reproduce.
Potentially related to improperly nested DIVs, as in this jQuery thread: http://stackoverflow.com/questions/14631512/window-open-is-openning-2-equal-windows
I've tried adding an explicit "return false;" after the window.open call, with no change.
Breakpoint analysis shows click event handlers added once per track on the initial load of the page, as expected.
I still see this behavior with v1.11.5 using the basic style.linkTemplate method of specifying a left click target URL, regardless of browser, but it remains difficult to replicate.
Clicking on any Transcript link here in Chrome will open two windows for the gene view: http://phytozome.jgi.doe.gov/jbrowse/index.html?data=genomes%2FCrubella&loc=scaffold_1%3A1..49062&tracks=Transcripts%2CAlt_Transcripts&highlight=
Same with a freshly cleared cache.
@rdhayes: I can at least confirm that this happens some of the time at the link you gave (only using Chrome). Weirdly, it does not even happen all of the time though.
Yes, this is a mystery.
Do we know which components from dojo and dijit run the actual mouse click events? This showed up very recently, so might be due to code changes pulled into the minified JBrowse builds.
Richard D. Hayes, Ph.D. Joint Genome Institute / Lawrence Berkeley National Lab http://phytozome.jgi.doe.gov
On Thu, Sep 11, 2014 at 1:55 PM, Colin [email protected] wrote:
@rdhayes https://github.com/rdhayes: I can at least confirm that this happens some of the time at the link you gave (only using Chrome). Weirdly, it does not even all of the time though.
— Reply to this email directly or view it on GitHub https://github.com/GMOD/jbrowse/issues/498#issuecomment-55327397.
The module to handle mouse clicks is dojo/on http://dojotoolkit.org/reference-guide/1.10/dojo/on.html
The code that sets up click handlers on CanvasFeatures are Line 684: renderClickMap Line 768: _connectEventHandlers
Still not sure of the actual cause of this. I only see one click event handler added per block per track.
Could this somehow be related to my commit from June that added click handler support to View/Track/WiggleBase.js? https://github.com/GMOD/jbrowse/commit/af3ca546ede9f449af79af82e72a77013e17bca1#diff-9076cb0582e18f0100a6debbf0ce64f2
I essentially cut and pasted _setupEventHandlers() from _FeatureDetailMixin.js, so maybe there's a track combination here that is causing the click event to be enabled twice?
Regardless, we have decided to mitigate this behavior in an upcoming release by switching to opening links in the same window/tab via action "navigateTo" rather than "newWindow".
I think I might know how to reproduce this bug:
Whenever you change the location in #widget_location
by a little, so that you still see the same canvas features, a click will be handled multiple times.
Example: Input 1..50000, click Go, click a canvas feature, click X on the dialog. Input 2..50000, click Go, click a canvas feature, click X, click X. Multiple dialogs were opened. Input 3..50000, click Go, click a canvas feature, click X, click X, click X. Input 4..50000, click Go, click a canvas feature, click X, click X, click X, click X.
Input 80000..100000, so that new features are generated, click Go, click a canvas feature, click X. Input 1..50000, click Go, click a canvas feature, click X.
(instead of #widget_location
you can also call navigateToLocation
with the same inputs multiple times)
Still have the problem in JBrowse 1.12.0, Firefox 43.0.1, Now I use "action": "navigateTo" Only.
Its not just Firefox. As far as I can tell this is a problem with CanvasFeatures. HTMLFeatures implements a check, _featureIsRendered which CanvasFeatures does not. The result is that when fillFeatures ends up getting called by setLocation and showTracks there are multiple click events set on the same feature. https://github.com/GMOD/jbrowse/blob/master/src/JBrowse/View/Track/CanvasFeatures.js#L246
We still need a really good way to reproduce this error...any method 100% reproduces it?
I tested my steps again on public demo Volvox mythicus example/test data. Small location changes still cause this
I agree.
Starting here: https://phytozome.jgi.doe.gov/jbrowse/index.html?data=genomes%2FEgrandis%2F&loc=Chr03%3A225696..237995&tracks=Blastx_protein%2CBlatx_Plant_protein&highlight=
Try updating the location to Chr03:226000..237995 through the location input field in the menu, which loads: https://phytozome.jgi.doe.gov/jbrowse/index.html?data=genomes%2FEgrandis%2F&loc=Chr03%3A226000..237995&tracks=Blastx_protein%2CBlatx_Plant_protein&highlight=
At least in my copy of Firefox, this causes multiple popups to open when you click on any orange feature here.
I can clear cookies and cache, load that same Chr03:226000..237995 fresh, and only have one popup.
Richard D. Hayes, Ph.D. Joint Genome Institute / Lawrence Berkeley National Lab http://phytozome.jgi.doe.gov
On Wed, May 3, 2017 at 4:46 AM, Luka Jeran [email protected] wrote:
I tested my steps again on public demo Volvox mythicus example/test data https://jbrowse.org/code/latest-release/?loc=ctgA%3A9900..32510&tracks=DNA%2CTranscript%2Cvolvox-sorted-vcf%2Cvolvox-sorted_bam%2Cvolvox_microarray_bw_xyplot%2Cvolvox_microarray_bw_density&data=sample_data%2Fjson%2Fvolvox&highlight=. Small location changes still cause this
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/GMOD/jbrowse/issues/498#issuecomment-298888687, or mute the thread https://github.com/notifications/unsubscribe-auth/AAc92Fk14IwvI33nadroZOZLRCUE6MXqks5r2GkZgaJpZM4CTDwQ .
from #1237:
JBrowse version: current master, releases 1.15.3, 1.15.4
Web browser being used: Chrome Version 69.0.3497.100, Firefox Version 69.0.3497.100
Operating system if relevant: MacOS High Sierra 10.13.6 (17G65) (prob. not relevant)
Issue: When selecting a track for visualization, left-clicking or right-clicking and selecting 'View details' on a feature shows details as expected. However, after refreshing a page with the selected track still up, further left-clicks spawn an extra window (right-clicking and going to details still only opens one details window as expected).
Steps to reproduce:
clone JBrowse (optionally check out any of the above listed releases)
run setup.sh
load data (tested with volvox sample data and our own test data-sets)
toggle a track on
refresh page
left click on a feature within the track
scratch head in puzzlement at two details windows
Notes: In some preliminary testing, I noticed that the details of the on-click handler are fully duplicated, in that the click handler gets called twice for the same feature (observed by placing a console.log() call that prints feature information during execution of the click handler). Maybe the reload attaches another handler to the feature? I haven't been able to clarify any further at this point.