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 open cell popovers causing auto height rows to bug out + misc cleanup #5622

Merged
merged 10 commits into from
Feb 10, 2022

Conversation

cee-chen
Copy link
Member

@cee-chen cee-chen commented Feb 10, 2022

Summary

This is an CSS-only alternative to #5618, and should (in theory) be a better approach with less side effects or edge cases on consuming applications. This also contains a lot more CSS cleanup.

Before

before

After

after

How does the fix work?

The main fix is 6b587ad which primarily just removes display: flex on .euiDataGridCell. Thanks to Chandler for pointing me in the right direction on what was happening:

the root cause is coming from the wrapped portal's dom node being injected next to the cell content, cutting the width in half which can scale down content (e.g. images).

Flexbox was the culprit for this, and was totally unnecessary on the .EuiDataGridCell - removing it did not affect any cell layout positioning as child wrappers were already taking care of that.

Why is the removed CSS no longer needed?

The flex CSS and width CSS is likely no longer necessary for the following reasons

QA

  • Single line cells should look the same as before, and should not bug out when opening popovers
  • Auto height cells should look the same as before, and should not bug out when opening popovers
  • Line count cells cells should look the same as before, and should not bug out when opening popovers
  • Focus guarded cells should look the same as before
  • Static pixel height cells should look the same as before

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
- [ ] Checked for breaking changes and labeled appropriately

  • Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

The `flex` display on the parent `.euiDataGridRowCell` is unnecessary, and what's causing this bug
- it's being overridden by react-window's absolute positioning in any case
…the popover anchor wrapper

- as far as I can tell, it's not doing anything
- the width properties aren't doing anything, so remove them

- the height property is doing something but is superfluous with the inline height: 100%, so remove the inline style

- add an overflow hidden to preserve overflowing content being correctly cropped by the cell padding when the popover is open (the EuiWrappingPopover adds extra div wrappers)
- can be conditional JSX instead of repeating EuiDataGridCellContent again
@kibanamachine
Copy link

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

@chandlerprall
Copy link
Contributor

Still going through examples, but found one issue with the focus ring being cut off on EuiButtons in a cell on https://eui.elastic.co/pr_5622/#/tabular-content/data-grid-focus

Before

Screen Shot 2022-02-10 at 12 02 33 PM

After

Screen Shot 2022-02-10 at 12 02 20 PM

@cee-chen
Copy link
Member Author

This cutoff was already occurring for me on latest main on Firefox. Is it not for you?

edit: interesting, looks like it was occurring on FF but not on webkit. I wonder why. Investigating

@chandlerprall
Copy link
Contributor

Second affected example, looks like the footer row no longer spans out of the viewport https://eui.elastic.co/pr_5622/#/tabular-content/data-grid-styling-and-control

Before

footer-before.mov

After

footer-after.mov

- footer cells aren't virtualized and don't have absolute positioning inline
+ move footer-specific CSS that virtualized data grid cells don't need to the footer row file
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.

I can no longer reproduce the button & footer focus ring nor the footer cell widths issues 🎉

Changes LGTM

@cee-chen cee-chen enabled auto-merge (squash) February 10, 2022 20:16
@kibanamachine
Copy link

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

@cee-chen cee-chen merged commit 91368b5 into elastic:main Feb 10, 2022
@cee-chen cee-chen deleted the datagrid/fix-auto-height-popover-2 branch February 10, 2022 21:01
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.

3 participants