Don't block scrolling when the direction is perpendicular to the slider
See original GitHub issueIssue
Touch scrolling is prevented when the initial touchpoint is on a noUiSlider:
Proposal
- Store the
touchstart
coordinates - Wait till the
touchmove
is a set distance away fromtouchstart
- maybe3vh
, or some configurable value - 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
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:12 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Solution that works for me:
touch-action: pan-y
CSS style on the sliderbehavior: 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 scrollingnoUiSlider currently uses
touch-action: none
to guarantee the page doesn’t scroll when using a slider. You could change that totouch-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.