Skip to content

Conversation

@weltenwort
Copy link
Member

@weltenwort weltenwort commented Jul 22, 2022

🗒️ Summary

This adds a mechanism to the EuiDataGrid to compensate for vertical layout shifts when rows above the currently visible ones change their height. This often happens when the row heights are "auto"-measured and new rows are rendered in the overscan area. By specifying a scrollAnchorRow: 'start', the grid will try to scroll to keep the vertical position of the topmost visible row stable in the viewport. This behavior is opt-in.

closes #6024
extracted from #6028

🎨 Previews

Checklist

  • Checked in both light and dark modes
  • Checked in mobile
  • Checked in Chrome, Safari, Edge, and Firefox
  • Props have proper autodocs and playground toggles
  • Added documentation
  • Checked Code Sandbox works for any docs examples
  • Added or updated jest and cypress tests
  • Checked for breaking changes and labeled appropriately
  • Checked for accessibility including keyboard-only and screenreader modes
  • Updated the Figma library counterpart (no visible changes)
  • A changelog entry exists and is marked appropriately

@weltenwort weltenwort self-assigned this Jul 22, 2022
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6070/

@weltenwort weltenwort marked this pull request as ready for review July 28, 2022 18:54
@weltenwort
Copy link
Member Author

@constancecchen @chandlerprall I'm struggling to find the time to write an example. Would you accept this with just the docs and tests, but without an example for now? 🙈

@weltenwort weltenwort changed the title Add scroll anchor row option [EuiDataGrid] Add scroll anchor row option Aug 1, 2022
@chandlerprall
Copy link
Contributor

@constancecchen @chandlerprall I'm struggling to find the time to write an example. Would you accept this with just the docs and tests, but without an example for now? 🙈

I'll get a pass at this PR tomorrow (U.S. time), but don't worry about an example - we'll either accept as-is or will put an example together for ya

Copy link
Contributor

@chandlerprall chandlerprall left a comment

Choose a reason for hiding this comment

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

This works really well! I played with a number of configurations locally and everything Just Worked™️

I've added this to the virtualization example, keeping the viewport anchored when toggling between the width options.

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6070/

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6070/

weltenwort and others added 2 commits August 3, 2022 11:10
…ample.js

Co-authored-by: Constance <constancecchen@users.noreply.github.com>
Co-authored-by: Constance <constancecchen@users.noreply.github.com>
@weltenwort
Copy link
Member Author

weltenwort commented Aug 3, 2022

@constancecchen @chandlerprall Thanks for the thorough review and contributing tests and an example ❤️

edit: not to forget correcting all by grammar mistakes

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_6070/

@weltenwort weltenwort merged commit e8dcfb2 into elastic:main Aug 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[EuiDataGrid] Reduce layout shift when row heights are measured automatically

4 participants