I'm trying to use the blur
event in d3, which is working fine in chrome and safari browser, but unfortunately, it is not working in firefox.
The purpose of using blur is to reset the other items after clicking outside the canvas.
Any workaround solution to the problem?
var width = 500;
var height = 400;
var svg = d3.select("#viz")
.append('svg')
.attr('width', width)
.attr('height', height)
.attr("preserveAspectRatio", "xMinYMin meet")
.attr("viewBox", "0 0 " + width + " " + height)
.append('g');
var outer = svg.append('g')
.attr('transform', "translate(" + width / 2 + "," + height / 2 + ")")
.attr('class', 'boundry');
var boundry = outer.append("svg:circle")
.attr("r", 100)
.attr("class", "primary-parent")
.attr('fill', 'red')
.attr('stroke', "yellow")
.attr("stroke-width", 5);
d3.selectAll('.primary-parent').on('click', function() {
alert("click event fired");
}).on("blur", function() {
alert("blur event fired");
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.11/d3.min.js"></script>
<div id="viz"></div>