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

[EuiTable EuiBasicTable] Fix nested content alignment when selection is enabled #7895

Merged

Conversation

mgadewoll
Copy link
Contributor

@mgadewoll mgadewoll commented Jul 18, 2024

Summary

closes #7888

Changes

  1. This PR updates how/where additional padding is applied to align nested table row content with the parent columns when selection is enabled.
    Previously the implementation of applying the padding on each nested table row resulted in overlapping content issues. This PR proposes to apply the padding on the outer wrapper for the nested table content.

before
Screenshot 2024-07-16 at 18 01 51

after
Screenshot 2024-07-18 at 15 51 25

  1. Additionally this PR fixes an issue with nested table action positioning on mobile screens.

before

Screenshot 2024-07-18 at 16 19 34

after

Screenshot 2024-07-18 at 16 19 42

QA

  • review the newly added Story for expanded and nested EuiBasicTable and verify it looks and works as expected
  • review the updated EuiTableRowCell story and confirm controls are working as expected

General checklist

  • Browser QA
    • Checked in both light and dark modes
    • Checked in mobile
    • Checked in Chrome, Safari, Edge, and Firefox
    • Checked for accessibility including keyboard-only and screenreader modes
  • Docs site QA
  • 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
    • If applicable, file an issue to update EUI's Figma library with any corresponding UI changes. (This is an internal repo, if you are external to Elastic, ask a maintainer to submit this request)

- moves conditional padding to the outer wrapper from the cell to align nested table content with the parent table column if a selection is present and prevent issues with overlapping content
- ensures correct positioning by appling styles only to direct children
- updates EuiTableRowCell stories to ensure expected controls behavior
@mgadewoll mgadewoll marked this pull request as ready for review July 18, 2024 17:04
@mgadewoll mgadewoll requested a review from a team as a code owner July 18, 2024 17:04
@walterra
Copy link
Contributor

Thanks for looking into this! I noticed in the "after" screenshot, is it intentional that we keep that margin for the whole expanded row?

image

Here's an older screenshot of one of our expanded rows where you can see there's no left padding:

image

@mgadewoll
Copy link
Contributor Author

Thanks for looking into this! I noticed in the "after" screenshot, is it intentional that we keep that margin for the whole expanded row?

@walterra Yes, that's expected and was already the existing behavior but ONLY when selection is enabled for the table. If enabled we offset the nested table by the selection checkbox width.
Based on your screenshot it looks like your table does not have selection enabled. For that case we don't add additional padding. 🙂

Here how it looks without selection enabled:
Screenshot 2024-07-19 at 10 42 32

@walterra
Copy link
Contributor

Oh great, thanks for confirming! I didn't notice I picked a screenshot that old that didn't have the bulk actions yet 😅 .

// Offset expanded & selectable rows by the checkbox width to line up content with the 2nd column
// Set on the `<td>` because padding can't be applied to `<tr>` elements directly
checkboxOffset: css`
.euiTableRowCell:first-child {
Copy link
Member

@cee-chen cee-chen Jul 22, 2024

Choose a reason for hiding this comment

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

I'm probably being a little nit-picky here, but wouldn't changing this to & > .euiTableRowCell:first-child { also have fixed the issue? I'm a little hesitant to apply new props to EuiTableRowCell mostly because it's a public top-level API change 🤷 (which would mean breaking changes or deprecations if they ever change again in the future)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh damn, yes you're absolutely right! I should have noticed that 🤦‍♀️
That is definitely a more straight forward solution. I'll update 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reverted the API changes here in favor of the suggested style solution.

@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

History

Copy link
Member

@cee-chen cee-chen left a comment

Choose a reason for hiding this comment

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

Beautiful!! Thank you for the story updates as well Lene!! ❤️

@cee-chen
Copy link
Member

Going to go ahead and merge this for this week's release

@cee-chen cee-chen merged commit e220343 into elastic:main Jul 22, 2024
5 checks passed
@mgadewoll mgadewoll deleted the table/7888-fix-nested-content-alignment branch July 22, 2024 17:00
cee-chen pushed a commit to elastic/kibana that referenced this pull request Jul 25, 2024
`v95.3.0` ⏩ `v95.4.0`

_[Questions? Please see our Kibana upgrade
FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)_

---

## [`v95.4.0`](https://github.com/elastic/eui/releases/v95.4.0)

- Added `anomalyChart`, `anomalySwimLane`, `changePointDetection`,
`fieldStatistics`, `logPatternAnalysis`, `logRateAnalysis` and
`singleMetricViewer` glyph to `EuiIcon`
([#7873](elastic/eui#7873))

**Bug fixes**

- Fixed overlapping content in `EuiBasicTable` for expanded and
selectable table rows
([#7895](elastic/eui#7895))
- Fixed the alignment of `EuiBasicTable` mobile actions
([#7895](elastic/eui#7895))

**Accessibility**

- Improved `EuiStat`'s screen reader accessibility
([#7864](elastic/eui#7864))

---

## Additional Changes

- reverts temporary fix for overlapping content in nested tables done in
PR [#188374](#188374)

---------

Co-authored-by: Elastic Machine <[email protected]>
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.

[EuiTable EuiBasicTable] Ensure nested content is correctly positioned and aligned
4 participants