Skip to content
This repository has been 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

Closed
guvial opened this issue Mar 7, 2017 · 1 comment

Comments

@guvial
Copy link
Contributor

guvial commented Mar 7, 2017

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

@guvial
Copy link
Contributor Author

guvial commented Mar 7, 2017

Pull request created : #2843

yotamberk pushed a commit that referenced this issue Mar 9, 2017
…k page in Firefox) (#2843)

* Update Core.js

Fix proposal for issue #2842

* useles comments removed as requested
yotamberk pushed a commit that referenced this issue Mar 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants