1

Currently a canvas element (which is built by a third party) on my webpage is intercepting drag events (because it assumes you want to drag something within the canvas), but this can "trap" the user within the canvas, especially if they zoomed in on it on mobile. I want the user to be able to scroll/swipe up and down on the canvas to reach the rest of the page above and below it, just like it were any other HTML element. They should be able to click into the canvas still, I just don't want the canvas to intercept regular page scrolling.

EDIT: I was able to find wheel and mousewheel events in the third-party code and remove them from the canvas object, resolving the issue for desktop users. Which event would be relevant for mobile users? I tried removing touchmove without success.

1 Answer 1

1

your issue seems to be that you're not correctly differentiating between scrolling and dragging.

I suggest you only prevent the default scrolling when the dragging actually takes place

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you. I had assumed a canvas element prevented scrolling right off the bat, but your answer suggests that might not be the case, which means I have to find where the default scrolling is prevented in the third-party code. I edited my question to be more clear. I resolved the issue for desktop users now, but still need to find the relevant event for mobile users where the third-party might be intercepting scrolling.
I ended up removing all "touch" events in the third-party code and it resolved my issue. Thanks for your answer, it helped me get on the right track.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.