d3 / d3-plugins

[DEPRECATED] A repository for sharing D3.js V3 plugins.
https://github.com/d3/d3/wiki/Plugins
Other
1.81k stars 684 forks source link

Double callback execution bugfix #162

Open heyitaki opened 6 years ago

heyitaki commented 6 years ago

I realize this is a deprecated repo, but the src code for d3.keybinding is hosted here, instead of as a separate repo anywhere else.

In d3.keybinding, the callback for each listener is called twice. This is happening because capture is being called twice (once from dispatch.on, and one once from bubble, which also is triggered by dispatch.on). Simply removing the capture listeners allows the code to work as expected.