vis-timeline icon indicating copy to clipboard operation
vis-timeline copied to clipboard

onclick event stolen

Open goodguy00 opened this issue 4 years ago • 4 comments

just pulled down newest timeline as a replacement of deprecated vis.js; worked fine, but: in the timeline content, i have a link for "do you want to know more" with an onclick popping up a little DIV. it does not work anymore. in FF debugger i saw, that a mouse event "onclick" is raised, but with "currentTarget: div.vis-timeline.vis-bottom.vis-ltr", not my DIV. why was the deprecated version capable of doing what the new version does, without stealing the onclick callback? resp, how can i avoid/ swicht off this in the present version to get my onclick back?

goodguy00 avatar Aug 09 '21 11:08 goodguy00

my code:

var container = document.getElementById('visualization0');
var items = new vis.DataSet([]);
items.add({id: 783, content: '[some text]', start: '2034-07-25 12:00', end: ' 12:00', type: 'point', title: '2034-07-25', group: 'group1'});
items.add({id: 785, content: '[some more text] <br/><a onclick=popUp785.open();>more...</a>', start: '2034-07-26 12:00', end: ' 12:00', type: 'point', title: '[title]', group: 'group1'});
window.addEvent('domready', function() {popUp785 = new PopUpWindow('[title]', { contentDiv: 'timelineDiv785', top: 0, left: 0 }); });
document.write( '<div id=timelineDiv785><em>[the more text]</div>' );
items.add({id: 788, content: '[some text] <br/><a onclick=popUp788.open();>more...</a>', start: '2034-07-28 12:00', end: '2034-08-04 12:00', type: 'range', title: '2034-07-28 :: 2034-08-04', group: 'group2'});
window.addEvent('domready', function() {popUp788 = new PopUpWindow('[title]', { contentDiv: 'timelineDiv788', top: 20, left: 20 }); });
document.write( '<div id=timelineDiv788><em>[more text]</div>' );
var options = { type: 'point', editable: false, multiselect: false, showCurrentTime: false, stack: true, timeAxis: { scale: 'day', step: 1}, start: '2034-07-24', end: '2034-09-22', clickToUse: false, orientation: {axis: 'both'} };
var timeline = new vis.Timeline(container, items, options);

REM: PopUpWindow.js comes from moontools

goodguy00 avatar Aug 09 '21 11:08 goodguy00

I also have this issue. I have a template option for events/items displayed in the timeline which contains an <a href="…">…</a>, but I cannot get the link to actually work. The click event is being stolen by something without my knowledge.

Jollywatt avatar Mar 30 '22 22:03 Jollywatt

Maybe this is caused by the new XSS protection!? See the new xss setting in the docs.

mojoaxel avatar Sep 02 '23 20:09 mojoaxel

Doesn't seem to be the case (set xss: { disabled: true}), "vis-ltr" still catches the event before

Screenshot 2023-10-19 at 12 02 13

zanella avatar Oct 19 '23 11:10 zanella