-
Notifications
You must be signed in to change notification settings - Fork 295
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Double click bug on foreignObject #267
Comments
This sounds like a browser quirk and not a D3 bug. |
I have tried it on Firefox, Chrome, and Edge. All of them had the same problem. You mean that d3 works correctly and all of them work incorrectly? |
D3 doesn’t intercept event listeners or define its own event lifecycle or anything like that, so if an event listener is behaving weirdly when you use D3 to register an event listener, it’ll behave weirdly in the same way as if you use the web standard API directly (e.g., element.addEventListener). Hence this is either a browser bug or the expected behavior of web standards, but unlikely to be an issue with D3 because of how D3 works. You can read the source of selection.on here: https://github.com/d3/d3-selection/blob/master/src/selection/on.js |
The problem may be related to how d3 renders the objects, not only how events are handled. If line 40 is commented, it seems to work correctly. There may be a difference in how d3 handles foreignObjects and ordinary objects. |
I encounter a problem in double clicking foreignObjects. In this code, when we double click in the circle , in the console both 'click' and 'dblclick' logs appear. But when we double click the foreign object (H), only the 'click' log appears. If we comment either line 35 or line 40, dblclick also works for the foreign object.
The text was updated successfully, but these errors were encountered: