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

[WIP] - replace preventDefaultTouchmoveEvent with touchEventOptions #235

Closed
wants to merge 1 commit into from

Conversation

hartzis
Copy link
Collaborator

@hartzis hartzis commented Mar 3, 2021

Attempt to remove preventDefaultTouchmoveEvent which has always been a very complicated and hard to describe prop and replace it with touchEventOptions.

Mimicking our good friends over at https://use-gesture.netlify.app/docs/options/#eventoptions

touchEventOptions: AddEventListenerOptions

  • defaults to { passive: true }
  • gives react-swipeable users more control over the events and when and if they want to call things like event.preventDefault

Possible solution for both #224 and #231.

TODOs:

  • update/fix/add tests
  • update documentation
  • add migration from preventDefaultTouchmoveEvent and examples on how to prevent scrolling via calling event.preventDefault in user land manually
  • add FAQ example for onTap solution when trackTouch and trackMouse are true

@hartzis
Copy link
Collaborator Author

hartzis commented Jun 17, 2021

Closing in favor of #240 and maintaining the ease provided by a prop to prevent scrolling.

After having a great discussion with @stefvhuynh about usability and interfaces we decided to move forward with a more user friendly prop that is explicit with it's intent, preventScrollOnSwipe.

We may also add these event options additionally to provide users with more power, but we can continue to investigate the need for that.

@hartzis hartzis closed this Jun 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Touch tap results in mouse events Preventing default event only in certain cases
1 participant