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

Feature request: optionally disable on desktop #91

Open
alexcroox opened this issue Mar 12, 2021 · 9 comments
Open

Feature request: optionally disable on desktop #91

alexcroox opened this issue Mar 12, 2021 · 9 comments

Comments

@alexcroox
Copy link

alexcroox commented Mar 12, 2021

It would be useful if we could optionally disable swipe actions on desktop, so that they only work if the user has a touch device.

The check would be something like:

isUsingTouchDevice: window && window.matchMedia('(any-pointer: coarse)').matches

and then exposed to users as:

Vue.use(Vue2TouchEvents, {
    disableSwipeOnDesktop: true
})
@euan-smith
Copy link

If this is done, I'd suggest disabling if touch is not present - I have a laptop with touch which I use. For a while many touch enabled pages didn't work on desktop because of the incorrect assumption that touch does not exist on desktop. It is best to decide these things on features present, rather than make assumptions.

@alexcroox
Copy link
Author

@euan-smith what does window.matchMedia('(any-pointer: coarse)').matches return in your browser dev tools on that touch laptop?

@euan-smith
Copy link

true on FF and Chrome

@alexcroox
Copy link
Author

thanks, no incorrect assumptions with that logic then

@euan-smith
Copy link

Sure, but probably rename to be {disableSwipeNoTouch: true} or similar to avoid misconceptions. An implementation based on your suggestion is fine - however other implementations which explicitly checked for desktop would also be possible. My comment was about the aim, which should be to disable swipe when touch is not present, rather than on desktop per-se.

@alexcroox
Copy link
Author

agreed, good suggestion

@jerrybendy
Copy link
Owner

ah... So... how to do that?

@alexcroox
Copy link
Author

alexcroox commented May 4, 2021

exit early in your binding if that plugin config option is set and window.matchMedia('(any-pointer: coarse)').matches === true?

@jerrybendy
Copy link
Owner

Could you change it or send a PR ? Thank you

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

No branches or pull requests

3 participants