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]: Opening dropdown should not scroll to selected item #18089

Open
2 tasks done
kglickman opened this issue Nov 15, 2024 · 4 comments
Open
2 tasks done

[Bug]: Opening dropdown should not scroll to selected item #18089

kglickman opened this issue Nov 15, 2024 · 4 comments

Comments

@kglickman
Copy link

Package

@carbon/react

Browser

Chrome

Package version

"1.67.0

React version

18.3.1

Description

We upgraded from 1.53.1 to 1.67.0. The behavior of the dropdown changed to scroll down to the currently selected item. This is not desirable behavior. I opened the dropdown because I want to change the value. Therefore, there's no reason to scroll down to see the selected one. Often, it means I just have to scroll back up.

For example,

  • Go the the story book and select Option 8.
  • Open the dropdown again and scroll all the way to the top and then close the dropdown. This is to simulate coming to the page for the first time, where the scrollbar will be at the top.
  • Now open the dropdown again and try to select Option 1. Since the dropdown autoscrolled Option 8 into view, I now have to scroll all the way back up to Option 1 to select it.

Now it could be that I only wanted to select Option 7, so the behavior isn't as annoying. But the scroll into view is really jarring and there's really no good reason I can think of that I would want to scroll the current value into view when I'm about to change it to something else.

QE has reported a bug on this and I had found it very annoying even before then.

Reproduction/example

see description above

Steps to reproduce

see description above

Suggested Severity

None

Application/PAL

No response

Code of Conduct

@rajat153
Copy link

Hi I am new to open source, I'm willing to do this , can you suggest me how to move forward.

@guidari
Copy link
Contributor

guidari commented Nov 18, 2024

Hey @kglickman
The fact that the Dropdown was not scrolling to the selected item before in this v11 version is a regression, because it used to work on v10 before.
Here a couple conversation so you can get more context regarding when was fixed: #15978 #16935
This is an expected behavior in Carbon.

@rajat153 We have a Contributing guide for you to get started here

@kglickman
Copy link
Author

kglickman commented Nov 18, 2024

@guidari I would not say that those two defects are the same. They are talking about when you are focused on an item. I'm not focusing, not typing, not using the arrow keys. I'm just opening the dropdown.

@guidari
Copy link
Contributor

guidari commented Nov 21, 2024

The issues might not be clear, but this PR introduced the scrollIntoView functionality for the dropdown when it opens. This was an expected feature that was missing after the migration from v10 to v11, which might explain why it seemed like a bug when we addressed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

3 participants