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] Various row height fixes #8025

Merged
merged 11 commits into from
Sep 19, 2024

Conversation

cee-chen
Copy link
Member

@cee-chen cee-chen commented Sep 14, 2024

Summary

This PR contains several fixes as well as storybook/VRT test updates. I strongly recommend following along by commit, as I continued to update VRT screenshots as I fixed bugs, which is helpful in seeing the visual diffs.

QA

General checklist

  • Browser QA
    • Checked in Chrome, Safari, Edge, and Firefox
    • Checked in mobile
      - [ ] Checked in both light and dark modes
      - [ ] Checked for accessibility including keyboard-only and screenreader modes
  • Docs site QA - N/A
  • Code quality checklist
  • Release checklist
    • A changelog entry exists and is marked appropriately.
      - [ ] If applicable, added the breaking change issue label (and filled out the breaking change checklist)
  • Designer checklist - N/A

…duction usages

- including complex children such as checkboxes & badges
- content is no longer inside a button, so text align is no longer needed and makes CSS overrides a little easier
- we're only rendering 5 rows so index 5 wasn't doing anything / applying to any row. this also clearly reveals a bug with lineCount: 2

- `onChange` needs to be reset to undefined because of `enableFunctionToggleControls`+`controls.include`
😭 not sure what past-me 3 years ago was smoking, but the `excludePadding` prop is no longer needed
…ons.lineHeight` change

- requires waterfalling `gridStyles` down to EuiDataGridCell
- remove the cached styles and just use `window.getComputedStyles` - which causes a reflow, but since we need it for lineHeight in any case we might as well keep using it 🤷
@cee-chen cee-chen marked this pull request as ready for review September 17, 2024 22:24
@cee-chen cee-chen requested a review from a team as a code owner September 17, 2024 22:24
autoHeight: css`
${logicalCSS('height', 'auto')}
`,
defaultHeight: css`
${logicalCSS('height', '100%')}
`,
// Control columns should be vertically centered with the *first line* of text
// for both single and multi-line heights (see https://github.com/elastic/eui/issues/7897)
controlColumn: css`
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we align the content horizontally as well?
Currently the controls in the story examples are not centered for cellPadding="s | l"

Screenshot 2024-09-18 at 15 59 42

Screenshot 2024-09-18 at 15 44 40

Screenshot 2024-09-18 at 15 44 48

Copy link
Member Author

@cee-chen cee-chen Sep 18, 2024

Choose a reason for hiding this comment

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

I noticed this too and I'm debating a separate PR for that where controlColumns.width does not include the cell padding, so that it scales with different densities and this off-centeredness doesn't occur.

Center alignment would solve the issue for the compact density, but not the expanded density, since technically the width provided is too small for both the expanded cell padding + the checkbox width.

Either way I'd like to address that separately from this PR, since that has more to do with column widths and less to do with row heights, and changing how the width API works for control columns would technically be a breaking change.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the context! I'm fine with addressing it in a separate PR then 👍

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

Copy link
Contributor

@mgadewoll mgadewoll left a comment

Choose a reason for hiding this comment

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

🚢 🐈‍⬛ Great work fixing all those smaller issues on datagrid! 👏

@cee-chen
Copy link
Member Author

Thanks a million as always for the thorough review/QA Lene!

@cee-chen cee-chen merged commit 84aa840 into elastic:main Sep 19, 2024
5 checks passed
@cee-chen cee-chen deleted the datagrid/linecount-1 branch September 19, 2024 15:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants