Skip to content

Infinite scroll in Combobox when using keyboard navigation #3692

Answered by diegohaz
bengry asked this question in Questions
Discussion options

You must be logged in to vote
  1. The user can't ↓ past the last item, meaning they don't see any loading indicator, and just suddenly the list gets longer after a couple of seconds.

The idiomatic solution is to apply scroll-margin to the last item:

.select-item:nth-last-child(1 of .select-item) {
  scroll-margin-block-end: 2rem;
}

3. The focus loops (which is a wanted behavior). Ideally when the infinite loading indicator is visible the focus wouldn't loop.

I believe this occurs because the keydown event, which checks for focusLoop, executes before React even updates the loading state. You could use the moveOnKeyPress prop as a function and check the scroll position or another synchronous state. However, I think th…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@bengry
Comment options

@diegohaz
Comment options

Answer selected by bengry
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants