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

Keep the scroller position while scrolling lazily and with undefined size #902

Merged
merged 16 commits into from
Sep 25, 2020

Conversation

mshabarov
Copy link
Collaborator

@CLAassistant
Copy link

CLAassistant commented Sep 10, 2020

CLA assistant check
All committers have signed the CLA.

@mshabarov mshabarov force-pushed the 386-improve-undefined-size-scrolling branch from addad21 to 6b1a465 Compare September 16, 2020 07:01
web-padawan
web-padawan previously approved these changes Sep 17, 2020
@web-padawan
Copy link
Member

I assume the fix can be tested in ComboBoxFlow, but it would be good to have a test for it here as well.

@tomivirkki
Copy link
Member

The scroll position should ideally be restored when only the size gets changed (not when the items is completely assigned a new value, for example on filter).

As it is, the suggested change causes the following UX regression (on filter the index is restored to a random position):

combo-box-index

Compare to the behavior in master:

combo-box-index-master

@mshabarov
Copy link
Collaborator Author

As it is, the suggested change causes the following UX regression (on filter the index is restored to a random position):

Good catch, thanks. Indeed, when we apply a filter, it may happen that the _restoreScrollerPosition method is invoked with the obsolete position and results in such a weird random scrolling. I fixed this by setting oldScrollPosition to 0 so as to avoid execution this scroll pos restore code.

The scroll position should ideally be restored when only the size gets changed (not when the items is completely assigned a new value, for example on filter).

I noticed the methods _getItems and _restoreScrollerPosition are invoked only when the size is changed actually. If you use a defined size mode and just scrolling to the end of list, then it only invoked once at the beginning.

@tomivirkki
Copy link
Member

Just tried with the latest revision and it still works the same as before:

Kapture 2020-09-21 at 10 29 03

@mshabarov
Copy link
Collaborator Author

I made a fix to address this regression with filtering and tested it with basic demo example using large size item array. Unit test has been modified as well, because previously it passed even with this regression. Please review.

src/vaadin-combo-box-data-provider-mixin.html Outdated Show resolved Hide resolved
src/vaadin-combo-box-dropdown-wrapper.html Outdated Show resolved Hide resolved
@mshabarov mshabarov merged commit b7df559 into master Sep 25, 2020
@mshabarov mshabarov deleted the 386-improve-undefined-size-scrolling branch September 25, 2020 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ComboBox scroller jumps to a top of dropdown when size is updated with a new estimated value
4 participants