react-component / react-component/slider
iOS - dragging slider handle also scrolls screen
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.1k
- Forks
- 768
- Avg merge
- 11d 22h
- Merged PRs (30d)
- 5
Description
This is similar to #258 but the solution there (adding touch-action: none) doesn't work because iOS doesn't support it - see https://caniuse.com/#feat=css-touch-action
Safari uses passive document touch listeners by default as of iOS 11:
https://developer.apple.com/library/archive/releasenotes/General/WhatsNewInSafari/Articles/Safari_11_1.html
In createSlider.jsx changing:
addDocumentTouchEvents() {
// just work for Chrome iOS Safari and Android Browser
this.onTouchMoveListener = addEventListener('touchmove', this.onTouchMove);
this.onTouchUpListener = addEventListener(this.document, 'touchend', this.onEnd);
}
...to...
addDocumentTouchEvents() {
// just work for Chrome iOS Safari and Android Browser
this.onTouchMoveListener = this.document.addEventListener('touchmove', this.onTouchMove, {passive: false});
this.onTouchUpListener = addEventListener(this.document, 'touchend', this.onEnd);
}
...appears to work. I'm not sure whether it's worth registering the listener against a narrower area of the DOM though (as opposed to the whole document)?
this solution likely breaks IE support, though:
https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener
...so you'd have to add some browser detection around it.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in createSlider.jsx at addDocumentTouchEvents and inspect the existing addEventListener helper. Reproduce slider dragging on iOS Safari, then check the listener behavior against the documented browser compatibility concerns, including IE. Done means dragging the handle no longer scrolls the screen without regressing supported browsers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend, mobile-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100