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

[Bug Report] V-Select scrolling behaviour #2660

Closed
asiFarran opened this issue Nov 28, 2017 · 25 comments · Fixed by #10944
Closed

[Bug Report] V-Select scrolling behaviour #2660

asiFarran opened this issue Nov 28, 2017 · 25 comments · Fixed by #10944
Assignees
Labels
C: VAutocomplete VAutocomplete C: VCombobox VCombobox C: VSelect VSelect T: bug Functionality that does not work as intended/expected T: enhancement Functionality that enhances existing features

Comments

@asiFarran
Copy link

Versions and Environment

Vuetify: 0.17.3
Vue: 2.5.9
Browsers: Chrome 62.0.3202.94
OS: Windows 7

Steps to reproduce

Give the select component a largish number of items (anything above 50 will do).

Open the select and start scrolling

Expected Behavior

The scrollbar thumb should be of constant height (representing the relationship between the overall height of the item list and the height of the popup element), and scrolling should be fluid and linear

Actual Behavior

The scrollbar's thumb starts off too high and as you begin to scroll, changes it's height and jumps to a different location on its track - basically disappearing from under the mouse cursor - thus leading to a jittery and uneven scrolling action making it almost impossible to reach the bottom of the list

Reproduction Link

https://codepen.io/anon/pen/RjYmJb?editors=1010

@KaelWD
Copy link
Member

KaelWD commented Nov 28, 2017

v-select lazy-loads items 20 at a time for performance reasons. This could be done with a set number of items at some point in the future though.

@KaelWD KaelWD added the T: enhancement Functionality that enhances existing features label Nov 28, 2017
@asiFarran
Copy link
Author

asiFarran commented Nov 28, 2017

I understand the perf concern but shouldn't the UX concern take precedence here?

The current strategy makes the component practically unusable when dealing with long lists so what's the point of having nice perf in a context that no-one would ever use unless they like to hear their users complain.

@cars10
Copy link

cars10 commented May 13, 2018

Yeah, that behaviour is really annoying and not at all user friendly. Any updates on that?

@KaelWD
Copy link
Member

KaelWD commented May 13, 2018

It was removed in 1.1 but had to be added back because of the massive performance impact if you have a lot of records. We're planning to add proper list virtualisation at some point, but probably not in 1.1

@cars10
Copy link

cars10 commented May 13, 2018

How about changing it into a prop? In my current project for example I have a fixed amount of about 150 records, would be cool if I could set the value myself.

@KaelWD
Copy link
Member

KaelWD commented May 13, 2018

Looks like the auto prop will render the entire list:

virtualizedItems () {
return !this.auto
? this.computedItems.slice(0, this.lastItem)
: this.computedItems
}

@cars10
Copy link

cars10 commented May 13, 2018

Great, thank you! Using auto will indeed render the whole list, guess i missed that in the documentation. Sadly this seems to break max-height (now having no effec, at least on 1.0.17), but i will use it anyway. Thanks!

@Webifi
Copy link
Contributor

Webifi commented Oct 26, 2019

:auto="true" doesn't seem to fix this for me on 2.1.6 -- and, if it did work, could kill performance when I only need to scroll to position 50 out of 300.

I think this could be solvable if we could easily change the default value of 20 for VSelect.lastItem to something else via a prop.

Could it be as simple as just adding something like this to VSelect.ts?:

props: {
  ...
  defaultLastItem: Number,
  ...
},
mount () {
  ...
  if (this.defaultLastItem > this.lastItem) this.lastItem = this.defaultLastItem
  ...
},
watch: {
  ...
  defaultLastItem (v) {
    if (v > this.lastItem) this.lastItem = v
  }
  ...
}

@avrtau
Copy link

avrtau commented Feb 6, 2020

Is there any news on this issue? Is there a work-around?

@londos
Copy link

londos commented Feb 6, 2020

Updating :auto="true" to :menu-props="{ auto: true }" worked for me.

@avrtau
Copy link

avrtau commented Feb 6, 2020

Updating :auto="true" to :menu-props="{ auto: true }" worked for me.

Passing menu-props="auto" worked. Thanks

@johnleider
Copy link
Member

This is pending the completion of #10944. Otherwise it will be bumped.

@v1talii-dev
Copy link

:menu-props="{ auto: true }" dont work in version 1.5.22. In which version does it work?

@avrtau
Copy link

avrtau commented May 25, 2020

:menu-props="{ auto: true }" dont work in version 1.5.22. In which version does it work?

Works on Vuetify 2.2+

@johnleider johnleider removed this from the v2.x.x milestone Jun 2, 2020
@nikalsh11
Copy link

nikalsh11 commented Jan 18, 2021

Updating :auto="true" to :menu-props="{ auto: true }" worked for me.

Thanks.

This also solved another issue with v-select where the scrollbar would occasionally not function at all (50+ items and customised css). Can confirm this works in Vuetify 2.4.2.

@hosseinmirhosseini76
Copy link

I fixed this by removing my height style on the page :)

@halimb
Copy link

halimb commented Jul 13, 2021

:menu-props="{ maxHeight: 'none' }" worked for me

@handhikadj
Copy link

handhikadj commented Aug 20, 2021

i'm having this on v2.5.8
the :menu-props workaround doesn't work

@bifshteks
Copy link

That's really a problem, because in case, when the height of menu is large enough to include 20 items visible on the screen,
the scrollbar does not appear, so user have to ways to scroll (thus, lazy loading will never load the rest of items)

@johnleider
Copy link
Member

That's really a problem, because in case, when the height of menu is large enough to include 20 items visible on the screen, the scrollbar does not appear, so user have to ways to scroll (thus, lazy loading will never load the rest of items)

This is absolutely a flaw in the system. I did it this way as a stop gap to not having a virtual-scroll component and it sort of stuck that way over the years.

No worries though, it is something we are addressing for Vuetify 3.

@juhasev
Copy link

juhasev commented Mar 6, 2022

Hi guys, the only way to fix the scrollbar issue is to set the menu props as follows:

:menu-props="{maxHeight: '80%', overflowX: true}"

This will load up all the elements and add scrollbar after 80% of height is consumed.
Yeah I know it is kind of weird that you need to add overflowX: true. Happened stumble on this after fighting for an hour!

@jsodeman
Copy link

As a related note, the lazy loading creates problems when doing e2e testing like cypress because the value you want might not be rendered yet. While I understand the performance issue, having to add :menu-props="{ auto: true }" to every v-select in our app so we can test is not fun.

@johnleider
Copy link
Member

As an update to this thread, Vuetify 3 selects all integrate virtual-scrolling by default. Closing this as completed.

@jhonprimedev
Copy link

Any update? The problem persists with 80 elements in "vuetify": "^3.4.6", is this bug still being worked on? Regards

@johnleider
Copy link
Member

Any update? The problem persists with 80 elements in "vuetify": "^3.4.6", is this bug still being worked on? Regards

Provide a reproduction and create a new issue, please do not comment on closed issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VAutocomplete VAutocomplete C: VCombobox VCombobox C: VSelect VSelect T: bug Functionality that does not work as intended/expected T: enhancement Functionality that enhances existing features
Projects
None yet
Development

Successfully merging a pull request may close this issue.