Open freakzlike opened 2 years ago
Thanks for the workaround, it works! Hopefully an official fix is coming like you suggested
How about such a solution? This worked for me.
document.body.addEventListener('touchmove', event => event.stopPropagation())
It is not possible to scroll with touch on the highlighted area or on the modal. However touch scroll on the grayed area and mouse scroll is possible.
Reproduce
This can be tested on shepherdjs.dev:
- Open shepherdjs.dev on small mobile device or with dev-tools
- Click through the first two steps till you reach the
02. Example
section- Try to touch scroll on the code snippet on the example (should not work)
- Try to touch scroll on the
01. How to include
code snippet (should work)- Try to scroll with mouse wheel (should work)
The default behavior of the
touchmove
event has been disabled here:Workaround
I'm currently using this workaround to avoid the call of
preventDefault
const allowTouchmove = (event) => { event.stopPropagation() } const tour = new Shepherd.Tour({ defaultStepOptions: { when: { show () { const target = this.getTarget() if (target) { target.addEventListener('touchmove', allowTouchmove) } }, hide () { const target = this.getTarget() if (target) { target.removeEventListener('touchmove', allowTouchmove) } } } } })
Suggestion
IMO the
preventDefault
of thetouchmove
event should be at least avoidable through the step configuration (something likeallowTouchScroll: true
). Also the behavior between mouse scroll, touch scroll on grayed area and touch scroll on highlighted area feels inconsistent and not understandable for a user.
This partially works but I am getting a bug, on a real device when the keyboard is showing up it gets hidden right after, and don't let me type anything.
@RobbieTheWagner I think this works as intended now? Tried the steps to repro and seems like it's fine.
It is not possible to scroll with touch on the highlighted area or on the modal. However touch scroll on the grayed area and mouse scroll is possible.
Reproduce
This can be tested on shepherdjs.dev:
02. Example
section01. How to include
code snippet (should work)The default behavior of the
touchmove
event has been disabled here: https://github.com/shipshapecode/shepherd/blob/99d4f995f79d6bf99ea55c2bd0c62f309f2de968/src/js/components/shepherd-modal.svelte#L90-L92 https://github.com/shipshapecode/shepherd/blob/99d4f995f79d6bf99ea55c2bd0c62f309f2de968/src/js/components/shepherd-modal.svelte#L98-L107Workaround
I'm currently using this workaround to avoid the call of
preventDefault
Suggestion
IMO the
preventDefault
of thetouchmove
event should be at least avoidable through the step configuration (something likeallowTouchScroll: true
). Also the behavior between mouse scroll, touch scroll on grayed area and touch scroll on highlighted area feels inconsistent and not understandable for a user.