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.

onSelect prop for triggering selecting same node

See original GitHub issue

When a node is selected, I trigger an information sidebar using onSelectionChange to open with details about that node. There is a button to close that sidebar. If closed, ReactFlow still considers that node selected, so selecting the same node previously selected does not trigger onSelectionChange and therefore I cannot trigger the sidebar to reopen. It would be nice to have onSelect which triggers every time so that this type of action could be supported.

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
moklickcommented, Apr 5, 2021

At the moment you can only use the internal setSelectedElements action mentioned in the comment by @sarasfive. When you press the close button you can reset the selection via setSelectedElements([]). After that the selection should work as expected again.

0reactions
moklickcommented, Feb 10, 2022

@pantchox Try to move the Provider one level up. I could imagine that your component isn’t wrapped.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change <select>'s option and trigger events with JavaScript
For example using following code, if I change the option with my mouse then an event triggers (i.e. onchange is run).
Read more >
Selection and Range - The Modern JavaScript Tutorial
JavaScript can access an existing selection, select/deselect DOM nodes as a whole or partially, remove the selected content from the document, ...
Read more >
onselect Event - W3Schools
The onselect event occurs after some text has been selected in an element. The onselect event is mostly used on <input type="text"> or...
Read more >
.select() | jQuery API Documentation
A function to execute each time the event is triggered. ... The method for retrieving the current selected text differs from one browser...
Read more >
HTMLElement: change event - Web APIs | MDN
The change event is fired for <input> , <select> , and <textarea> elements ... like addEventListener() , or set an event handler property....
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