preventDefault on sourceEvent, if present

This prevents a crash when d3_event is not the actual event, but is a
transition event or similar
This commit is contained in:
Bryan Housel
2018-11-06 14:16:23 -05:00
parent bd98b87d46
commit 3d65dd8903
+5 -2
View File
@@ -223,8 +223,11 @@ export function uiSidebar(context) {
sidebar.toggleCollapse = function(shouldCollapse) {
if (d3_event) {
d3_event.preventDefault();
var e = d3_event;
if (e.sourceEvent) {
e.sourceEvent.preventDefault();
} else if (e) {
e.preventDefault();
}
var container = d3_select('#id-container');