Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Click functions on children of items don't fire on touch events #557

Open
Draconizations opened this issue Apr 12, 2024 · 6 comments
Open
Labels
bug Something isn't working

Comments

@Draconizations
Copy link
Contributor

0.9.43 introduces a bug where click functions of children of items (i.e. a button inside a dnd item) will not fire on touch devices. Calling e.stopPropagation or e.stopImmediatePropagation in the child click handler does not work here.

There is a workaround. Adding a touchend listener to the child element, with the same handler as the onclick listener, seems to function identically to the old behavior, and it doesn't activate after actually dragging the item.

Figured I'd open an issue, in case there is an actual fix that can be added to the library itself. As well as notify others that there is a workaround here.

@isaacHagoel
Copy link
Owner

Thanks for reporting. I'll try to make time tomorrow or early next week to look into possible solutions

@isaacHagoel isaacHagoel added the bug Something isn't working label Apr 13, 2024
@WhyAsh5114
Copy link

same issue here, thanks @Draconizations for the workaround

WhyAsh5114 added a commit to WhyAsh5114/MyFit that referenced this issue Apr 20, 2024
@isaacHagoel
Copy link
Owner

Damn, it doesn't reproduce for me in the browser using emulation or on my Google Pixel.
This is what I tried: https://svelte.dev/repl/68d1c34d92f04c0f9f89d1d3ca47324a?version=4.2.15
Am I doing something wrong, if not what are you using to reproduce the issue?

@WhyAsh5114
Copy link

it seems like using a button for a drag handle causes some issues

https://svelte.dev/repl/02030329daf64b129ffe3adbf3cf1403?version=4.2.15
try replacing the div element with a button, and it no longer works as expected, maybe we are supposed to use a div element only? (btw the tailwindcss doesn't work unless u change a style or so, just modify any inline style a bit and it starts working)

@WhyAsh5114
Copy link

ok, noticed something much weirder and the actual reason why I started experience this bug in the first place

https://svelte.dev/repl/df0a77452e324e10bd205aa6d613125d?version=4.2.15
when I use a svg inside the drag handle, the click stops working, normal text works as expected

@StagnantIce
Copy link

StagnantIce commented Nov 16, 2024

i have the same problem, as i can see touchend not check what i click not on the nodeElement.

Please add in all places e.target.click && e.target.click() instead e.target.click()

preiter93 pushed a commit to preiter93/time-tracker that referenced this issue Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants