moveable icon indicating copy to clipboard operation
moveable copied to clipboard

The button event can not be triggered

Open nzbin opened this issue 4 years ago • 10 comments

Environments

  • Framework name: null
  • Framework version: null
  • Moveable Component version: 0.26.0
  • Testable Address(optional): https://codesandbox.io/s/moveable-jpwgh?file=/index.html

Description

When upgrade moveable to latest version (v0.26.0), the button event can not be triggered.

https://codesandbox.io/s/moveable-jpwgh?file=/index.html

nzbin avatar Oct 27 '21 10:10 nzbin

@nzbin

The click event is blocked.

Use moveable's click event instead.

<Moveable onClick={e=>{}}/>


new Moveable.on("click", e => {

});

daybrush avatar Oct 28 '21 01:10 daybrush

I am very confused. I have updated the demo, there has three different button, how can I trigger the different event?

There has many complex scenario that need capture events binding to element in Moveable.

nzbin avatar Oct 28 '21 03:10 nzbin

@nzbin

I will change it so that it does not block the click event in the next version.

daybrush avatar Oct 28 '21 03:10 daybrush

Great, many thanks!

nzbin avatar Oct 28 '21 03:10 nzbin

Well, amazing. Today I was facing the same issue and I was trying to bang my head. Basically, when the draggable = true, I do not get the click event on the element. I hope this issue will solve that.

sagrawal31 avatar Oct 31 '21 17:10 sagrawal31

@sagrawal31

Test [email protected] (beta)

daybrush avatar Oct 31 '21 17:10 daybrush

Thanks for the test release. I realized later that this issue is for React apps while I'm using vanilla JS in my Angular app.

sagrawal31 avatar Nov 01 '21 04:11 sagrawal31

Hi, @daybrush. As I have mentioned above, I'm actually facing the same issue with Vanilla JS (using 0.26.0). When the draggable is set to true on an element, any of its child nodes/elements are not receiving the click event.

While this problem does not exist if draggable: false. For example- when I try to click on that image in the screenshot, the click event is not received on the image element, and it only comes to the parent, i.e. selected element.

image

For now, I have added this hack as a workaround to the problem-

image

Any thoughts? Maybe instead of fixing at React, some fix is required at the lower level?

sagrawal31 avatar Nov 04 '21 19:11 sagrawal31

@sagrawal31 @nzbin

  • moveable 0.27.1
  • react-moveable 0.30.1
  • preact-moveable 0.29.1
  • ngx-moveable 0.23.1
  • svelte-moveable 0.18.1
  • lit-moveable 0.4.1
  • vue-moveable 2.0.0-beta.3
  • vue3-moveable 0.2.1

moveable's new version is released. Check it again.

daybrush avatar Nov 09 '21 17:11 daybrush

@daybrush, I just tested the release 0.27.1, and the problem is gone 🤩 Thanks a ton!

sagrawal31 avatar Nov 13 '21 11:11 sagrawal31