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

Documentation: Defining handleEnd (or any event handler) in the configuration overrides the event handler completely. #46

Open
wesharper opened this issue Mar 20, 2024 · 3 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@wesharper
Copy link

I've experienced this with other handlers, but most recently with handleEnd. I have a handleEnd function that does nothing but console.log, yet it breaks expected behavior on touch devices. Likely due to an event getting canceled when the callback is fired.

Repro: https://codesandbox.io/p/sandbox/fk-drag-touch-repro-forked-fy4pz9?file=%2Fpackage.json%3A12%2C38

Video:

Screen.Recording.2024-03-20.at.1.52.38.PM.mov
@sashamilenkovic
Copy link
Contributor

sashamilenkovic commented Mar 20, 2024

@wesharper Ah yes, when you define handleEnd, you are actually overriding the core event handler itself. The idea is to import the original handleEnd and reinvoke it before or after whatever logic you are trying to add on: sandbox. We plan in the future to implement events you can listen to instead of needing to override the handler itself. Probably would be worth adding an example of this to the docs as other people have been confused by this as well.

@sashamilenkovic sashamilenkovic self-assigned this Mar 20, 2024
@sashamilenkovic sashamilenkovic added the documentation Improvements or additions to documentation label Mar 20, 2024
@wesharper
Copy link
Author

Ah, makes sense. Thanks for the feedback. Perhaps there could be an onEnd or onHookName pattern that doesn't override default behavior but acts more as a way to fire off your own logic?

@patrickdundas
Copy link

@wesharper Ah yes, when you define handleEnd, you are actually overriding the core event handler itself. The idea is to import the original handleEnd and reinvoke it before or after whatever logic you are trying to add on: sandbox. We plan in the future to implement events you can listen to instead of needing to override the handler itself. Probably would be worth adding an example of this to the docs as other people have been confused by this as well.

Thanks for mentioning this @sashamilenkovic, I ran into a similar issue with performTransfer as specifying it caused the default transfer functionality to break, which was unexpected. Event handlers / listeners would be a much better solution or this needs to be more widely documented as myself and others are wasting a lot of time figuring this out

@sashamilenkovic sashamilenkovic changed the title Bug: handlers on touch/mobile don't work as expected Documentation: Defining handleEnd in the configuration overrides the event handler completely. Apr 21, 2024
@sashamilenkovic sashamilenkovic changed the title Documentation: Defining handleEnd in the configuration overrides the event handler completely. Documentation: Defining handleEnd (or any event handler) in the configuration overrides the event handler completely. Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants