Skip to content
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

[Feature Request] v-slide-group momentum and scroll lock #10673

Closed
jaunt opened this issue Feb 25, 2020 · 13 comments · Fixed by #11571 or #13005
Closed

[Feature Request] v-slide-group momentum and scroll lock #10673

jaunt opened this issue Feb 25, 2020 · 13 comments · Fixed by #11571 or #13005
Assignees
Labels
C: VSlideGroup help wanted We are looking for community help T: feature A new feature

Comments

@jaunt
Copy link

jaunt commented Feb 25, 2020

Problem to solve

On mobile touch based devices, if you try swiping left and right the experience is not ideal. First, there's no momentum when you let go -- the illusion of physical weight. Second, as you try to swipe through content horizontally, finger movements in the vertical direction cause the screen to scroll up and down unexpectedly.

Proposed solution

Once horizontal swipe intent is determined, vertical scroll passthrough should be temporarily disabled. Add realistic gestures like momentum scrolling: https://material.io/design/interaction/gestures.html

@ghost ghost added the S: triage label Feb 25, 2020
@johnleider
Copy link
Member

I would love to do this, but I need help with this particular one.

@johnleider johnleider added C: VSlideGroup T: feature A new feature help wanted We are looking for community help and removed S: triage labels Mar 25, 2020
ClickerMonkey added a commit that referenced this issue Jun 6, 2020
johnleider pushed a commit that referenced this issue Jun 6, 2020
johnleider added a commit that referenced this issue Jun 6, 2020
johnleider added a commit that referenced this issue Jun 6, 2020
partially implements #10673

Co-authored-by: John Leider <john.j.leider@gmail.com>
@johnleider johnleider linked a pull request Jun 6, 2020 that will close this issue
8 tasks
@johnleider
Copy link
Member

Implemented vertical scroll issues in #11571. We'll work on momentum for v3.

@dumptyd
Copy link

dumptyd commented Jun 26, 2020

Changes from #11571 don't let the user scroll at all on phones. https://jsfiddle.net/dumptyd/r96botke/

@AeonFr
Copy link

AeonFr commented Jul 10, 2020

We are experiencing the oposite issue: when the user is clearly trying to scroll vertically, the slider is highjacking the scroll and not producing vertical scroll. This can be tested in the documentation.
This makes the usage of this component as a "carrousel" (or anything that should be full screen) inviable because the user won't be able to continue scrolling on the page

@Elis4beth
Copy link

Elis4beth commented Jul 28, 2020

Hi ! Same problem as @AeonFr here. So i added some custom code to improve user experience on mobile.
I used v-touch of vuetify to detect the direction of the scroll (top or bottom) and sweet-scroll to move the screen according to the direction of the touch.

v-touch: https://vuetifyjs.com/en/directives/touch-support/
sweet-scroll: https://github.com/tsuyoshiwada/sweet-scroll

So i have a child component "Slider" where is one of my vuetify sliders. I putted my v-touch on v-slide-item and $emit the event to my parent component:

        <v-slide-item
          v-for="(podcast, index) in data.results"
          :key="'recents-' + index"
          v-touch="{
            left: () => $emit('childSwipe', {'direction': 'Left', 'index': 0}),
            right: () => $emit('childSwipe', {'direction': 'Right', 'index': 0}),
            up: () => $emit('childSwipe', {'direction': 'Up', 'index': 0}),
            down: () => $emit('childSwipe', {'direction': 'Down', 'index': 0})
          }"
        >

As you see, my parent will have the direction and the index of my DOM element. I have 4 sliders on my page so i added #id on each slider "#vertical-position"+index. If you have just only one slider, you don't need this dynamic code and just need to scroll to a static id element on top or bottom according to the direction of the touch (see my parent code below. The scroll go to my header or footer depending on whether it comes from the first slider child or last one)

<template>
<div v-for="(category, key) in categories.results" :key="'category-' + key">
          <Slider :id="'vertical-position-'+key"
                       :category="category"
                       @childSwipe="swipe"
          />
        </div>
</template>

<script>
import SweetScroll from 'sweet-scroll'
const scroller = SweetScroll.create(
  {
    duration: 1000,
    easing: 'easeOutExpo',
  }
)

methods: {
    //Fix scroll problem when mobile user is touching slider
    swipe: function(values) {
      //Only for mobile
      if (this.isMobile) {
        if (values.direction === 'Up') { //go bot
          //If user is on last list, scroll to footer
          if (values.index == 3) {
            scroller.to('.footer')
          } else { //else scroll to next list
            scroller.to('#vertical-position-'+ (values.index+1))
          }

        } else if (values.direction === 'Down') { //go top
          //If user is on first list, scroll to header
          if (values.index == 0) {
            scroller.to('#header')
          } else { //else scroll to above list
            scroller.to('#vertical-position-'+ (values.index-1))
          }
        }
      }
    }
  },
</script>

Hope this can help someone and sorry for my baguette English ;)

@Elis4beth
Copy link

Sooo.. my temporary solution above is bad too because this is an assisted scroll (#div to #div), not very smooth. And more important, i reproduced the same problem as @jaunt when navigating on the site and come back on my slider page. I haven't seen it earlier. So i just display a custom div with css overflow-y. Native scroll on mobile is better. And display vuetify slider only on desktop for now.

@AeonFr
Copy link

AeonFr commented Jul 30, 2020 via email

@jaunt
Copy link
Author

jaunt commented Aug 14, 2020

Vertical scroll seems to be broken as mentioned above.

I have a list of feeds, something like netflix, and now a user can't scroll unless they grab in-between feeds which is awkward and unexpected.

The solution I proposed originally was to only lock vertical scrolling once horizontal scrolling was detected, then release that lock the moment it stopped.

My hack for now, in case it helps anyone:

<style scoped>
>>> .v-slide-group__wrapper {
  touch-action: auto !important;
}
...

Yukaii added a commit to Disfactory/frontend that referenced this issue Sep 27, 2020
@gakinson
Copy link

Vertical scroll seems to be broken as mentioned above.

I have a list of feeds, something like netflix, and now a user can't scroll unless they grab in-between feeds which is awkward and unexpected.

The solution I proposed originally was to only lock vertical scrolling once horizontal scrolling was detected, then release that lock the moment it stopped.

My hack for now, in case it helps anyone:

<style scoped>
>>> .v-slide-group__wrapper {
  touch-action: auto !important;
}
...

This was great, I ended up using

touch-action: pan-y !important 

When I used auto, i found my x-axis carousel scrolling was choppy and not as smooth as when I used pan-y.
Thanks for showing this temp fix, it really helped make due for now!

@agustinfranc
Copy link

Vertical scroll seems to be broken as mentioned above.
I have a list of feeds, something like netflix, and now a user can't scroll unless they grab in-between feeds which is awkward and unexpected.
The solution I proposed originally was to only lock vertical scrolling once horizontal scrolling was detected, then release that lock the moment it stopped.
My hack for now, in case it helps anyone:

<style scoped>
>>> .v-slide-group__wrapper {
  touch-action: auto !important;
}
...

This was great, I ended up using

touch-action: pan-y !important 

When I used auto, i found my x-axis carousel scrolling was choppy and not as smooth as when I used pan-y.
Thanks for showing this temp fix, it really helped make due for now!

Thanks both!

@andreortega

This comment has been minimized.

@mahammad-sixberries
Copy link

mahammad-sixberries commented May 14, 2021

try this

.v-slide-group__wrapper {
    touch-action: auto;
    overflow: scroll;
    scroll-behavior: smooth;
    scroll-snap-type: x mandatory;
}

@johnleider
Copy link
Member

We kindly ask users to not comment on closed/resolved issues. If you believe that this issue has not been correctly resolved, please create a new issue showing the regression or create a new discussion.

If you have any questions, please reach out to us in our Discord community.

@vuetifyjs vuetifyjs locked as resolved and limited conversation to collaborators May 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C: VSlideGroup help wanted We are looking for community help T: feature A new feature
Projects
None yet
10 participants