Repository navigation
Let the page scroll when a touch moves across a slider - #3099
Open
martin-s-a wants to merge 1 commit into
Open
martin-s-a wants to merge 1 commit into
martin-s-a wants to merge 1 commit into
Conversation
The slider set its value as soon as a touch went down, and touch-action: none kept the browser from scrolling, so a vertical swipe that started on a horizontal slider changed its value instead of scrolling the page. The slider now leaves the other axis to the browser (pan-y, or pan-x when vertical), and DraggableElement gets a touchAxis option: a touch only starts a drag once it moves along that axis, a touch that doesn't move is a tap, and a touch the browser takes over to scroll does nothing. Mouse and pen drags start on press as before.
|
@martin-s-a is attempting to deploy a commit to the Font Awesome Team on Vercel. A member of the Team first needs to authorize it. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3098.
On a touch screen, a vertical swipe that started on a horizontal
<wa-slider>changed its value instead of scrolling the page:#sliderhadtouch-action: none, and the slider set its value in the drag'sstart, whichDraggableElementruns onpointerdown/touchstart.slider.styles.ts:touch-action: pan-yfor a horizontal slider andpan-xfor a vertical one, so the slider keeps its own axis and the browser can scroll along the other.drag.ts: atouchAxisoption forDraggableElement. When it is set, a touch only starts a drag once it moves 10px along that axis. A touch that doesn't move is a tap, sostartandstoprun when it ends, and a touch the browser cancels to scroll never starts. Mouse and pen drags start on press as before, anddrag()is unchanged.slider.ts: passestouchAxis, fromorientation, to the track and thumb draggables of single and range sliders.Tests: three slider tests with touch pointer events, for a touch the browser cancels before it moves along the slider (the value stays and no events are emitted), a touch released without moving (sets the value) and a touch that only starts dragging after it moves along the slider. The
slidergroup passes in Chromium in both rendering modes, and fails withtouchAxisignored. Firefox and WebKit aren't installed in my environment, so CI is the first run there. I also checked it in Home Assistant's gallery with touch emulation in Chromium 156: a vertical swipe that starts on the slider scrolls the page and leaves the value, including one that drifts sideways and a second swipe during the fling of the first, while a tap, a sideways drag and a mouse press still set it. Not tested on a physical Android or iOS device.