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

[EuiDataGrid] Fix paginated & height-limited datagrids becoming unscrollable on rowCount change #5400

Merged
merged 4 commits into from
Nov 22, 2021

Conversation

cee-chen
Copy link
Contributor

@cee-chen cee-chen commented Nov 22, 2021

Summary

Problem

height being set to undefined means that finalHeight falls back to unconstrainedHeight here on line 641:

let finalHeight = IS_JEST_ENVIRONMENT
? Number.MAX_SAFE_INTEGER
: height || unconstrainedHeight;

Which leads to .euiDataGrid__virtualized and the inner content being the same unconstrainedHeight, resulting in inner content that never scrolls:

Before

before.mp4

Solution

Having the main setHeight() logic (lines 604-608) respond dynamically to rowCount fixes the issue. I did some testing and was also fairly sure that the setHeight(undefined) line was unnecessary and that just adding rowCount as a dependency/side effect of determining the wrapper height was sufficient to solve the initial issue in #5313, but would appreciate a confirmation of that @chandlerprall!

After

after.mp4

Regression testing

regression-test.mp4

Checklist

- [ ] Check against all themes for compatibility in both light and dark modes
- [ ] Checked in mobile

  • Checked in Chrome, Safari, Edge, and Firefox

NOTE: Heights are still not working quite the same on my local Firefox as on Chrome, but we ascertained this appears to be individual to my Firefox in #5313 (comment)

- [ ] Props have proper autodocs and playground toggles
- [ ] Added documentation
- [ ] Checked Code Sandbox works for any docs examples

Not 100% sure about adding tests for this as #5391 did not have any

- [ ] Checked for breaking changes and labeled appropriately
- [ ] Checked for accessibility including keyboard-only and screenreader modes

  • A changelog entry exists and is marked appropriately

@kibanamachine
Copy link

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

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.

LGTM! Talked through the change together & paired on testing in the PR's deployed docs.

Please remove the row count range before merging.

@cee-chen cee-chen enabled auto-merge (squash) November 22, 2021 19:31
@kibanamachine
Copy link

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

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] Vertical scroll becomes disabled with pagination and content change
3 participants