Skip to content
This repository was archived by the owner on Jul 29, 2019. It is now read-only.
This repository was archived by the owner on Jul 29, 2019. It is now read-only.

Redirect to blank page after drag and drop to create an item in the timeline.js with FireFox #2842

@guvial

Description

@guvial

Hello,

Thanks for your great work. I am using the timeline lib and it is amazing !

I have found a bug when using drag and drop in FireFox to create a new item in the timeline with FireFox. Chrome, Safari and IE do not seem to suffer from this issue.
After dropping a new item on the timeline, FireFox redirect the user to a blank page.
I could reproduce the issue using your example page : http://visjs.org/examples/timeline/other/drag&drop.html

After having searched a little bit on the net, I found a solution I want to share with you.

I have modified the code of the timeline/component/Core.js. I have changed the function "handleDrop(event)" like that and it fixed my issue :

function handleDrop(event) {
// FIX drop redirect in FIREFOX : START
if(event.preventDefault) { event.preventDefault(); }
if(event.stopPropagation) { event.stopPropagation(); }
// FIX drop redirect in FIREFOX : END

// return when dropping non-vis items
try {
var itemData = JSON.parse(event.dataTransfer.getData("text"))
if (!itemData.content) return
} catch (err) {
return false;
}
itemAddedToTimeline = false;
event.center = {
x: event.clientX,
y: event.clientY
}
me.itemSet._onAddItem(event);
return false;
}

As I am not an expert, I am not sure that is the best way to solve the issue. I would be interested to get your feedback on it. It could help someone else facing the same issue to find a workaround and perhaps help you to integrate this fix in the next release.

Thanks again for your great work.

Guillaume

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions