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

sl-select with multiple scrolls to first selected for any change #1138

Closed
callum-ramage opened this issue Jan 19, 2023 · 1 comment
Closed
Assignees
Labels
bug Things that aren't working right in the library.

Comments

@callum-ramage
Copy link

Describe the bug

Any interaction that causes a change to value (e.g. selecting an option) will cause the option list to scroll to the first selected option.

All roads lead here.
https://github.com/shoelace-style/shoelace/blob/next/src/components/select/select.ts#L480

To Reproduce

Steps to reproduce the behavior:

  1. Create a sl-select with a list of options long enough to create a scroll bar and multiple enabled (preferably a bit longer to make it more obvious)
  2. Open the select list
  3. Select an option near the top of the list
  4. Scroll down
  5. Select and option near the bottom of the list
  6. The select will automatically scroll to the first selected option

Demo

https://codepen.io/callum-ramage-the-selector/pen/ZEjaaWg

Browser / OS

  • OS: Windows
  • Browser: Chrome, Firefox, Edge
  • Browser version: Firefox 108.0.2
@callum-ramage callum-ramage added the bug Things that aren't working right in the library. label Jan 19, 2023
@claviska
Copy link
Member

I can't find any reason why that was added. It should scroll into view when the control is opened, which it does, but it shouldn't be doing that when items are toggled. Fixed in 29c671c. This fix will be available in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Things that aren't working right in the library.
Projects
None yet
Development

No branches or pull requests

2 participants