-
-
Notifications
You must be signed in to change notification settings - Fork 7k
fix(VSlideGroup): detect horizontal/vertical swipe intent #13005
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
fix(VSlideGroup): detect horizontal/vertical swipe intent #13005
Conversation
fixes vuetifyjs#12293/npartically fixes vuetifyjs#10673
// sliding horizontally | ||
this.scrollOffset = this.startX - e.touchmoveX | ||
// temporarily disable window vertical scrolling | ||
document.documentElement.style.overflowY = 'hidden' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When swiping horizontally, I tried to achieve disabling vertical scrolling or touch swipe via css by setting touch-action
to pan-x
. However, touch-action
only takes effect from next touch swipe, therefore changing touch-action
to pan-x
during onTouchMove
will not restrict current touch move to "horizontal only" but has to wait until next touch action starts.
Hence I use a javascript way that disables whole page's vertical scroll if swiping horizontally is determined. (And remove this style in touchEnd
event triggered in same component VSlideGroup
). Please advice if there is a better way to disable vertical scroll passthrough once horizontal swipe intent is detected
@babyraging can you reproduce your issue in #11571 with this? |
ddbea7b
to
c7a93f7
Compare
Hi @johnleider , I did a test simulating @babyraging issue in #11571, this pull request does resolve it. This is the mock that I used to test: <template>
<v-container>
<v-chip-group
mandatory
column
active-class="primary--text"
>
<v-chip
v-for="tag in tags"
:key="tag"
>
{{ tag }}
</v-chip>
</v-chip-group>
</v-container>
</template>
<script>
export default {
data() {
return {
tags: [
'Work',
'Home Improvement',
'Vacation',
'Food',
'Drawers',
'Shopping',
'Art',
'Tech',
'Creative Writing',
'Shopping',
'Art',
'Tech',
'Shopping',
'Art',
'Tech',
'Shopping',
'Art',
'Tech',
'Shopping',
'Art',
'Tech',
'Work',
'Home Improvement',
'Vacation',
'Food',
'Drawers',
'Shopping',
'Art',
'Tech',
'Creative Writing',
'Shopping',
'Art',
'Tech',
'Shopping',
'Art',
'Tech',
'Shopping',
'Art',
'Tech',
'Shopping',
'Art',
'Tech',
'Work',
'Home Improvement',
'Vacation',
'Food',
'Drawers',
'Shopping',
'Art',
'Tech',
'Creative Writing',
'Shopping',
'Art',
'Tech',
'Shopping',
'Art',
'Tech',
'Shopping',
'Art',
'Tech',
'Shopping',
'Art',
'Tech',
'Work',
'Home Improvement',
'Vacation',
'Food',
'Drawers',
'Shopping',
'Art',
'Tech',
'Creative Writing',
'Shopping',
'Art',
'Tech',
'Shopping',
'Art',
'Tech',
'Shopping',
'Art',
'Tech',
'Shopping',
'Art',
'Tech',
'Work',
'Home Improvement',
'Vacation',
'Food',
'Drawers',
'Shopping',
'Art',
'Tech',
'Creative Writing',
'Shopping',
'Art',
'Tech',
'Shopping',
'Art',
'Tech',
'Shopping',
'Art',
'Tech',
'Shopping',
'Art',
'Tech',
'Work',
'Home Improvement',
'Vacation',
'Food',
'Drawers',
'Shopping',
'Art',
'Tech',
'Creative Writing',
'Shopping',
'Art',
'Tech',
'Shopping',
'Art',
'Tech',
'Shopping',
'Art',
'Tech',
'Shopping',
'Art',
'Tech',
],
};
}
};
</script>
Also, @babyraging please feel free to leave any comments |
Eagerly awaiting this fix 🙏 Recently deployed a few slides on a single page and it’s very difficult to scroll the page on mobile. If you need someone to try this out to confirm it fixes vertical scroll on mobile I should be able to verify on my site tomorrow night. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take a look at the globals issue. You won't be able to import using the @
syntax.
Hi @johnleider , just want to clarify, should I add |
Hi all - super appreciative of the work you're all doing. Looking to give this a bump cause it should make our site a lot more usable on mobile. |
Would you mind helping to verify if this fix resolves your website issue? I am happy to give you a guidance of how to do it if you need help ;) |
Absolutely, I'll have time tomorrow night EDT. I'll give you a shout if I have any trouble. |
@yuwu9145 I can confirm this fixes our slide group issue. Our page looks roughly like this:
Before your fix we'd be able to recreate the issue in Chrome dev tools with the following steps:
This normally would prevent vertical scroll. With your fix, we can click any item in the slide group and scroll vertically. Very eager to see this PR touched up and merged :) |
@HammerMeetNail Thanks a lot! |
fixes #12293
partically fixes #10673
Description
As per suggestions in #10673,
VSlideGroup
should determine swipe intent (horizontal or vertical) first, then using swipe intent to only allow one of horizontal/vertical swipe gestures between eachonTouchStart
andonTouchEnd
sessionfixes #12293
partically fixes #10673
Motivation and Context
fixes #12293
partically fixes #10673
How Has This Been Tested?
visually
Markup:
Types of changes
Checklist:
master
for bug fixes and documentation updates,dev
for new features and backwards compatible changes andnext
for non-backwards compatible changes).