Skip to content

Conversation

@cee-chen
Copy link
Contributor

Summary

closes #5139
closes #5131

You gotta love it when a fix just involves removing logic! 🔥

Quick summary of changes - the previous finalHeight = window.innerHeight - toolbarHeight - headerRowHeight - footerRowHeight calculation likely came from pre-virtualization and is no longer necessary. There's no need for a separate isFullScreen logic - EuiDataGridBody's wrapper dimensions update on full screen toggle and resize correctly due to flexbox. react-window should simply use that wrapper's height & width, the same way it does in non-full-screen mode.

Before

Note how bottom row is cut off and how the horizontal scrollbar does not appear after increasing the width of a column

before

After

Note how bottom row is not cut off and how the horizontal scrollbar does appear after increasing the width of a column

after

Checklist

- [ ] Check against all themes for compatibility 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 NOTE: No jest tests added here due to no unit tests previously existing for this file + the presence of IS_JEST_ENVIRONMENT, but it's on my TODO list to add more unit tests for our utils/ shortly

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

  • A changelog entry exists and is marked appropriately

- There's no need for a separate isFullScreen branch in this logic: EuiDataGrid's wrapper will update its dimensions on full screen toggle, and react-window should simply use that wrapper's height & width, the same way it does in non-full-screen mode
@cee-chen
Copy link
Contributor Author

Re: 96a33bb and ee9e7d1 - feel free to shout if I should revert/leave that logic in if you think we will need isFullScreen or toolbarHeight in the future for other EuiDataGridBody logic.

@kibanamachine
Copy link

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

@cee-chen
Copy link
Contributor Author

Huh, so.... that Cypress spec failure is legit, I can repro it in https://eui.elastic.co/pr_5557/#/tabular-content/data-grid-focus.

Basically only when headers are not interactive, gridWidth is coming in as 0 to <EuiDataGridToolbar /> and not updating until the datagrid is clicked into. So I guess ee9e7d1 was somehow triggering an update/rerender and causing the toolbar to work???...

I can add the toolbar ref back in if we want it, but I could also fix the issue with a forceRender... the issue just seems super bizarre though honestly, would def appreciate jumping on a call to debug it if you have time.

@cee-chen
Copy link
Contributor Author

I added the forceRender workaround in 53a4f4b, but would also be opening to reverting 53a4f4b and ee9e7d1. Just let me know!

@kibanamachine
Copy link

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

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.

Woohoo! Love seeing less code leading to a better experience. This shows how strong the dimensions watching/height calculation has become.

I played with the examples locally and couldn't find any bugs/regressions. Constance and I paired to look at why non-interactive headers required a workaround, which led to acf5853

@cee-chen cee-chen enabled auto-merge (squash) January 25, 2022 22:02
@cee-chen cee-chen disabled auto-merge January 25, 2022 22:02
@cee-chen cee-chen enabled auto-merge (squash) January 25, 2022 22:02
@kibanamachine
Copy link

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

@cee-chen cee-chen merged commit 96918d9 into elastic:main Jan 25, 2022
@cee-chen cee-chen deleted the datagrid/5139/5131 branch January 25, 2022 22:46
gdimitropoulos pushed a commit to gdimitropoulos/eui that referenced this pull request Apr 21, 2022
* Fix incorrect scrolling height on full screen grids

- There's no need for a separate isFullScreen branch in this logic: EuiDataGrid's wrapper will update its dimensions on full screen toggle, and react-window should simply use that wrapper's height & width, the same way it does in non-full-screen mode

* Remove unused props

* Remove now-unnecessary isFullScreen prop from EuiDataGridBody

* Remove now unnecessary toolbar ref/height observer

* Add changelog entry

* Workaround for failing spec / toolbar hiding itself on non-interactive headers

* Swap a useRef for a useState to trigger a re-render after mount

Co-authored-by: Chandler Prall <chandler.prall@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

3 participants