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

Shadow DOM: touchmove not working on mobile #1060

Merged
merged 1 commit into from Mar 27, 2020
Merged

Shadow DOM: touchmove not working on mobile #1060

merged 1 commit into from Mar 27, 2020

Conversation

Shackless
Copy link
Contributor

I tried to use noUiSlider in a Stencil web component using the ShadowDOM (shadow: true) and noticed that the slider handle can't be dragged on mobile. If I disable the ShadowDOM in my web component, everything works fine.

I traced this back to the function isTouchOnTarget that always returns false when it's called in the scope of e.type === "touchmove".

(Touch) events in the ShadowDOM are redirected to their host element. You can observe that checktouch.Target is the host element while eventTarget is the handle div within the shadow root of the component. Of course, the div does not contain the host element but it's actually the other way around. To check this, you have to call contains on the shadowRoot element in the host.

I'm not sure if there is a better approach to fix this but dragging on mobile does work now even in a shadowed web component.

@Shackless Shackless changed the title Additionally check if a touch originated within the shadowRoot Shadow DOM: touchmove not working on mobile Mar 10, 2020
@leongersen leongersen added this to the 14.2.0 milestone Mar 27, 2020
@leongersen leongersen merged commit 63b84ce into leongersen:master Mar 27, 2020
@leongersen
Copy link
Owner

I just merged this and released it as noUiSlider 14.2.0. Thanks for contributing!

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.

None yet

2 participants