Skip to content

Reorder causing click events to not get fired #29

@TimoLehnertz

Description

@TimoLehnertz

Describe the bug

When a node receives a pointerdown event, a nodepicked message is emited.
inside of order.ts these messages get intercepted and content.reorder(view.element, null) gets called. Moving the picked node to the top.
So far, so good. But the reordering temporarily removes and readds the element from the document. This seems to prevent click events on nodes to ever be fired because the mousedown event is fired on a node that is no more considered the same to the one where the mouseup event is fired. (They are the same but got moved in the dom tree).
Uncommenting content.reorder(view.element, null) disables the reordering but enables click events to be fired again.

For some reason I am only able to reproduce this with react. I also tried angular but there clicks work fine. I cant say why that is.

additional info

I got this but on the following versions:

  • area-plugin 2.1.5
  • 1.something
  • the current main branch
  • React 18
  • React 19

I did some experiments and I did find a workarround. When the nodepicked message is sent not on mousedown but instead on mouseup and then the reorder function gets called inside a timeout then problem is fixed.
It is a hacky solution but it works. If I had a cleaner solution I would make a pr right away.

Example to reproduce

https://codesandbox.io/p/devbox/rete-js-v2-customization-forked-jxgc4h?from-embed=

How to reproduce

Expected behavior

Click events should always be fired.

Dependencies

Platform

Chrome

Relevant log output

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions