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

Keyboard navigation does not scroll with max-height and overflow: auto #221

Closed
4 tasks
heinrichti opened this issue May 8, 2021 · 4 comments
Closed
4 tasks
Labels
bug Something isn't working

Comments

@heinrichti
Copy link

heinrichti commented May 8, 2021

  • System Information

    • Chrome 90
    • Windows 10
  • Describe the bug
    When navigating with the keyboard the scrollable resultlist does not scroll with the selection.

  • To Reproduce
    I created a jsfiddle that demonstrates the behavior: https://jsfiddle.net/fzkyvrab/3/
    Enter the search box, start typing 'f' and press down with keyboard a few times. The selected item will be out of the visible area and you have to manually scroll down to see it

  • Expected behavior
    The search field should make it so that the active element is always visible (scrolled to it)

@heinrichti heinrichti added the bug Something isn't working label May 8, 2021
@heinrichti heinrichti changed the title Keyboard navigation does not scroll with overflow: auto Keyboard navigation does not scroll with max-height and overflow: auto May 8, 2021
@TarekRaafat
Copy link
Owner

Hello @TimHeinrich,

Unfortunately, list scrolling is not supported in v9.

But it's already implemented in the coming major release v10 if you would like to check it and share your thoughts.

v10 is expected to be released within the coming two weeks.

Cheers, and have a nice day! :)

@heinrichti
Copy link
Author

Hi @TarekRaafat, thank you, I didn't expect a solution this quickly!

Here are a few thoughts on the scrolling: It works out of the box, this is a great improvement for me 👍

A few things I noticed: The class autoComplete_selected does not seem to be set anymore, so I updated my CSS like this, which works again:

.autoCompleteWrapper >>> [aria-selected='true'],
.autoCompleteWrapper >>> .autoComplete_result:hover {
  cursor: pointer;
  background-color: rgba(51, 217, 178,0.2);
}

The smooth scrolling effect looks is nice, but if I press and hold the down key it is way too slow (for me it just scroll-wiggles a little up and down while the selection goes through the list), so it would be nice to have a way to disable smooth scrolling or detect that I am holding the key down and only scroll smooth if I haven't scrolled in the last few ms or something like that.

Thanks again, and a nice day to you as well :)

@TarekRaafat
Copy link
Owner

Very good point and I believe that your first suggestion would be more flexible because it would allow you to programmatically achieve the second behavior as well.

Thanks!

@TarekRaafat
Copy link
Owner

Auto-Scroll has been added to v10.0.3, but unfortunately, I had to roll back and use another method for scrolling instead of scrollIntoView due to its weird behavior of moving the entire page while scrolling.

Yet, I'll keep investigating other methods until I achieve the previous smooth scrolling behavior with the auto switch, which I really liked, and I'll let you know as soon as I figure it out.

For the time being, you should be good to go with the current functionality, and of course, feel free to let me know if you have any other thoughts.

Have a nice day! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants