I have a svg
area in the middle of the screen, where I move some SVG elements around, by using D3 drag behavior. Below the svg
, I have some options, in a div
like this:
<div id="gui-options">
<div onclick="sortCards()">
<span>Sort cards</span>
</div>
...
</div>
When I have dragged some elements around in the svg, I have to click twice to trigger sortCards()
. The first click is not registered. The implementation of sortCards()
is not important to this problem.
I have tried to add click handlers after the DOM is ready, but that doesn't make any difference.
I don't have this problem when the drag-functionality is disabled. If I click twice on an option, I only have to click once to toggle the other options. But if I drag some elements two clicks is necessary to "change focus".
Do you have any suggestions where the solution might be hiding?