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

Add the ability to scroll an item into view in the virtual scroller #1488

Merged
merged 1 commit into from
Oct 28, 2024

Conversation

pleek91
Copy link
Collaborator

@pleek91 pleek91 commented Oct 28, 2024

Description

Adds a new utility getVirtualScroller where you can get access to a virtual scroller instance by its given name (which is now a prop on the virtual scroller component). This way we can grab a scroller at any point in the component tree. The available actions are

  • makeItemVisible - Accepts an itemKey and forces the chunk that item belongs to to be visible
  • scrollItemIntoView - Accepts an itemKey and automatically scrolls to that item.

@pleek91 pleek91 requested a review from a team as a code owner October 28, 2024 13:55
Copy link

netlify bot commented Oct 28, 2024

Deploy Preview for prefect-design ready!

Name Link
🔨 Latest commit a14c504
🔍 Latest deploy log https://app.netlify.com/sites/prefect-design/deploys/671f97e1726b1800087f172d
😎 Deploy Preview https://deploy-preview-1488--prefect-design.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

@znicholasbrown znicholasbrown left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Comment on lines +142 to 145
function getChunkHeight(index: number): number {
return props.itemEstimateHeight * chunks.value[index].length
}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wow, we were severely underestimating these heights huh

@pleek91 pleek91 merged commit 6a396e8 into main Oct 28, 2024
6 checks passed
@pleek91 pleek91 deleted the virtual-scroller-scroll-item-into-view branch October 28, 2024 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants