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

Using scrollToIndex with sticky headers #33

Open
keedyc opened this issue Jan 25, 2024 · 0 comments
Open

Using scrollToIndex with sticky headers #33

keedyc opened this issue Jan 25, 2024 · 0 comments
Assignees
Labels
question Further information is requested

Comments

@keedyc
Copy link

keedyc commented Jan 25, 2024

Background

I'd like to make a virtual table with a few characteristics:

  1. a sticky header row
  2. keyboard shortcuts (⬆️ and ⬇️) to change the selected row
  3. auto-scroll to reveal a newly-focused row if it's partly offscreen

Attempts

I tried to implement this in two ways shown in this example code, but each had an issue 😅

  1. Put the header in slot="header"

    • Auto-scrolling reveals only part of a row when navigating down. This seems to happen because the header row shifts the other rows down, and auto-scrolling based on scrollToIndex doesn't take that shift into consideration. Based on this comment about invisible elements, I think this is the expected behavior in this case.
  2. Put the header in slot="item"

    • Auto-scrolling reveals only part of a row when navigating up. This seems to happen because the sticky header row hides the topmost row.

Questions

  1. Is there another way to do what I have in mind?
  2. If not, would you be open to a PR that tweaks existing behavior to fit this use case?

Thanks in advance for any insight you can offer! 🙏

@jonasgeiler jonasgeiler added the question Further information is requested label Feb 12, 2024
@jonasgeiler jonasgeiler self-assigned this Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants