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

[fix] ComboBox scroll behavior #1693

Closed
suzubara opened this issue Oct 14, 2021 · 0 comments · Fixed by #1715
Closed

[fix] ComboBox scroll behavior #1693

suzubara opened this issue Oct 14, 2021 · 0 comments · Fixed by #1715
Assignees
Labels
high priority Active blocker for a current project or just urgent type: bug Something isn't working like it's supposed to

Comments

@suzubara
Copy link
Contributor

suzubara commented Oct 14, 2021

ReactUSWDS Version & USWDS Version:

ReactUSWDS 2.2.0 (not present in USWDS)

Describe the bug

I'm using the ComboBox in an application, and when I click into the input it moves the scroll position of the entire page which is a bad UX. I cannot reproduce this in the USWDS Combo Box example so I think it's something to do with our implementation.

To Reproduce
Steps to reproduce the behavior:

  • Load a page that shows the ComboBox component below the scroll fold
  • Scroll down to the ComboBox component and click on the input to open the list
  • The whole page scroll jumps

Expected behavior

When I click into the input, the scroll position of the page should not change.

Screenshots

Scroll bug:
scrollbug

Compare to:

noScrollbug

Additional context

It looks like the USWDS source code adjusts the scrollTop of the list element itself, whereas our component uses scrollIntoView on the highlighted item. I'm guessing that's what is causing this behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
high priority Active blocker for a current project or just urgent type: bug Something isn't working like it's supposed to
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant