Default event action preventing
See original GitHub issueUsing vtk.js in a React project, onClick action does not work.
It appears that the RenderWindowInteractor stops events’ propagation.
Besides defining a class that inherits from RenderWindowInteractor and avoids events propagation, do you have an other solution ?
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
Event.preventDefault() - Web APIs | MDN
The preventDefault() method of the Event interface tells the user agent that if the event does not get explicitly handled, its default ...
Read more >Browser default actions - The Modern JavaScript Tutorial
To prevent a default action – use either event.preventDefault() or return false . The second method works only for handlers assigned with on< ......
Read more >Prevent the default action of an event - HTML DOM
Prevent the default action of an event · 1. Return false for the on<event> · 2. Use the preventDefault() method.
Read more >How to Prevent Default Action of an Event ... - JavaScript Tutorial
This tutorial shows you how to prevent the default action of an event by using the preventDefault() method of the Event object.
Read more >What is event.preventDefault() in JavaScript? - Educative.io
In JavaScript, these events' actions can be canceled. Yes, they can be kept from executing the default action that is associated with it....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Instead of using
onClick, try usingonClickCapturein react. That will get the click on the capture phase of event propagation, since vtkjs invokes preventDefault on the bubble phase (which is listened to withonClick).here’s a modified example of your jsfiddle: https://jsfiddle.net/k1jLk0uw/
I don’t know what removing L55 will do to other parts of vtkjs/projects using vtkjs, and maybe it won’t break anything, but at the very least the above should work for you.
Fixed in #694. Closing.