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

[Autocomplete] Prevent reset scroll position when new options are added #1042

Closed
lensroman opened this issue Mar 28, 2023 · 1 comment
Closed

Comments

@lensroman
Copy link

Duplicates
I have searched the existing issues
Latest version
I have tested the latest version
Current behavior 😯
I'm implementing async load with pagination with the Autocomplete.
When the listbox is open and the user scroll to the bottom, we load the next page and add the new options.
After adding, the position of the scroll on the listbox is reseted and the scroll goes to the top.

Expected behavior 🤔
The scroll position should not change so the user can continue the search for the option

Steps to reproduce 🕹
I've used the Select Country example in the docs and tweek to load the countries with paging.
I was abe to reproduce the issue without any async request, just loading more items from the fixed array.

https://codesandbox.io/s/confident-kare-5n6i6

Context 🔦
No response

Your environment 🌎
npx @mui/envinfo
@emotion/react: 11.7.1
@emotion/styled: 11.6.0
@mui/material: 5.2.4
react: 17.0.2

System:
OS: Windows 10 10.0.19044
Binaries:
Node: 16.12.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.17 - C:\Program Files\nodejs\yarn.CMD
npm: 8.3.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: Not Found
Edge: Spartan (44.19041.1266.0), Chromium (96.0.1054.57)Duplicates
I have searched the existing issues
Latest version
I have tested the latest version
Current behavior 😯
I'm implementing async load with pagination with the Autocomplete.
When the listbox is open and the user scroll to the bottom, we load the next page and add the new options.
After adding, the position of the scroll on the listbox is reseted and the scroll goes to the top.

Expected behavior 🤔
The scroll position should not change so the user can continue the search for the option

Steps to reproduce 🕹
I've used the Select Country example in the docs and tweek to load the countries with paging.
I was abe to reproduce the issue without any async request, just loading more items from the fixed array.

Its already fixed by mui mui/material-ui#35735. Please can you implement fix to your library

@lensroman lensroman closed this as not planned Won't fix, can't repro, duplicate, stale Mar 28, 2023
@lookfirst
Copy link
Owner

Hey @lensroman ... just checking to see what your solution was in case someone else finds this in the future and needs to figure things out.

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

No branches or pull requests

2 participants