question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Don't block scrolling when the direction is perpendicular to the slider

See original GitHub issue

Issue

Touch scrolling is prevented when the initial touchpoint is on a noUiSlider:

Proposal

  1. Store the touchstart coordinates
  2. Wait till the touchmove is a set distance away from touchstart - maybe 3vh, or some configurable value
  3. If the direction is perpendicular to the component, stop blocking the scroll event until touchend

Alternatively, on step 3, you could start blocking the scroll event if parallel to the component

Tap and Slide

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:12 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
lukaskabrtcommented, Oct 31, 2018

Solution that works for me:

  • set touch-action: pan-y CSS style on the slider
  • set behavior: none in the slider initialization - users can’t tap the slider to set its value, but it prevents them from accidently changing the slider value while scrolling
1reaction
leongersencommented, Jan 12, 2018

noUiSlider currently uses touch-action: none to guarantee the page doesn’t scroll when using a slider. You could change that to touch-action: pan-up pan-down (etc.) for horizontal sliders, with left/right for vertical. That’s not a change I think is smart: any touches near the slider shouldn’t be at risk of glitchy behaviour, such a page scroll. Safari doesn’t support these properties anyway, so the benefit is small.

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript - Prevent scrolling of parent element when inner ...
1. Basic problem. Scrolling input (i.e.: mousewheel) applied to the modal element will spill over into an ancestor element and scroll it in...
Read more >
Well-controlled scrolling with CSS Scroll Snap - web.dev
The CSS Scroll Snap feature allows web developers to create well-controlled scroll experiences by declaring scroll snapping positions.
Read more >
overscroll-behavior - CSS: Cascading Style Sheets | MDN
The overscroll-behavior CSS property sets what a browser does when reaching the boundary of a scrolling area.
Read more >
Support nested scrolling elements with the same scroll direction.
Nesting scroll views with a scroll direction perpendicular to the ViewPager2's orientation inside ... Emmm, I don't know Have you ever tested fast...
Read more >
Block on a Frictionless Inclined Plane
The block speeds up as it slides down How does the speed at the bottom depend ... the slider and trigger The Demonstration...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found