question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

isInteractive is preventing custom click handlers

See original GitHub issue

I have a use-case where I want to disable the graph from being changed. (E.g: nodes being dragged) but I still want to be able to click them to trigger UI changes elsewhere (E.g: a sidebar being opened with node information).

I believe is-interactive is a good solution for this but the implementation of it is causing some issues. Because it’s setting pointer-events: none on the nodeWrapper, click handlers in custom nodes are not being triggered. I can override it by setting pointer-events: all on the inner element that I want to attach a click listener to but for some reason this prevents panning, zooming, … all interactivity when hovering on a node.

Steps to reproduce:

  • Disable interactivity
  • Adjust a node’s style to have pointer-events: all
  • Notice that only on this node you will not be able to zoom/pan/…

My suggestion is to add a flag that only disables the dragging / modification of the graph but keeps all attached listeners active.

Another option could be to drive the interactivity from CSS and be able determine as the implementor which pointer-events: none | all | auto are getting set based on the class given to the parent graph.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
moklickcommented, Jul 13, 2020

Hey,

we just released v.4.0.0. There we dropped isInteractive and added nodesDraggable, nodesConnectable and elementsSelectable. This use case should be working with nodesDraggable = false and nodesConnectable and elementsSelectable = true. You can see a working example here: https://react-flow.netlify.app/interaction. Can you confirm @bartvanremortele ?

1reaction
moklickcommented, Jul 15, 2020

Good catch @emielwit! The bug should be fixed with version 4.2.2

Read more comments on GitHub >

github_iconTop Results From Across the Web

Prevent click event from firing after a custom event
Main issue was connected to mouse up emitted before click event. I've my small changes in mouseup listener in mentioned directive.
Read more >
Button events | Decentraland Documentation
This function declares what to do in the event of a button down event while ... cursor changes shape to hint to the...
Read more >
ion-modal: Ionic Mobile App Custom Modal API Component
ion-modal can be used by writing the component directly in your template. This reduces the number of handlers you need to wire up...
Read more >
Interactive figures — Matplotlib 3.6.2 documentation
For the figures to be responsive to mouse, keyboard, and paint events, the GUI event loop needs to be integrated with an interactive...
Read more >
An Interactive Guide to JavaScript Events
Learn how event capturing, targeting, and bubbling work in JavaScript; how to prevent an event's default behavior; how to stop event ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found