Skip to content

[EuiListItemLayout][EuiSelectableTemplateSitewide] Fix text content alignment#9669

Merged
mgadewoll merged 9 commits into
elastic:mainfrom
mgadewoll:listitemlayout/fix-content-alignment
May 26, 2026
Merged

[EuiListItemLayout][EuiSelectableTemplateSitewide] Fix text content alignment#9669
mgadewoll merged 9 commits into
elastic:mainfrom
mgadewoll:listitemlayout/fix-content-alignment

Conversation

@mgadewoll
Copy link
Copy Markdown
Contributor

@mgadewoll mgadewoll commented May 20, 2026

Summary

This PR updates EuiListItemLayout (internal component) to fix unexpected list item alignment e.g. in EuiSelectableTemplateSitewide when highlighting is applied.

The issue was that a previous added style that was meant to help with custom content alignment, was too broad and would apply to children if the node was a single child + text (as text by itself is not considered a child as it's not a node by the CSS selector). There is no way for us to generically apply it to all cases this way, as non-wrapped text would always break it. Instead we can apply the style to known cases instead (until such cases are migrated to the appropriate API - using the prepend slot - on consumer side) and anything else needs to be handled on consumer side, as they pass their custom content.

API Changes

⚪ No API changes

Screenshots

Before After
Screenshot 2026-05-20 at 15 03 41 Screenshot 2026-05-20 at 15 03 44
Screenshot 2026-05-20 at 14 06 02 Screenshot 2026-05-20 at 18 39 37
Screen.Recording.2026-05-20.at.13.39.23.mov

Impact Assessment

Note: Most PRs should be tested in Kibana to help gauge their Impact before merging.

  • 🔴 Breaking changes — What will break? How many usages in Kibana/Cloud UI are impacted?
  • 💅 Visual changes — May impact style overrides; could require visual testing. Explain and estimate impact.
  • 🧪 Test impact — May break functional or snapshot tests (e.g., HTML structure, class names, default values).
  • 🔧 Hard to integrate — If changes require substantial updates to Kibana, please stage the changes and link them here.

Impact level: 🟢 None

ℹ️ The changes were tested in Kibana CI
💻 Kibana-a-la-carte

Release Readiness

  • Documentation: {link to docs page(s)}
  • Figma: {link to Figma or issue}
  • Migration guide: {steps or link, for breaking/visual changes or deprecations}
  • Adoption plan (new features): {link to issue/doc or outline who will integrate this and where}

QA instructions for reviewer

  • open EuiSelectabletemplateSitewide (storybook), type something in the search that matches a list item and verify that highlighted item text in is correctly aligned with non highlighted text
  • verify that the added custom content story examples are correctly aligned (?path=/story/internal-euilistitemlayout--custom-content&globals=colorMode:light)
  • verify that the EuiListItemLayout kitchen sink (storybook) looks fine (no unexpected misalignments)

Checklist before marking Ready for Review

Reviewer checklist

  • Approved Impact Assessment — Acceptable to merge given the consumer impact.
  • Approved Release Readiness — Docs, Figma, and migration info are sufficient to ship.

mgadewoll added 5 commits May 20, 2026 15:01
- the selector was too broad and applied to single child nodes + text as well, resulting in misalignment. Since CSS doesn't offer us any proper solution to detect non-wrapped text as children, we'll rather need to apply the style for known use cases
@mgadewoll mgadewoll self-assigned this May 20, 2026
@mgadewoll mgadewoll marked this pull request as ready for review May 20, 2026 15:51
@mgadewoll mgadewoll requested a review from a team as a code owner May 20, 2026 15:51
Copilot AI review requested due to automatic review settings May 20, 2026 15:51
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adjusts EuiListItemLayout’s internal text alignment styling to prevent highlighted text (e.g., <mark> wrappers used by search highlighting) from shifting list item content alignment, with a targeted workaround for an existing Kibana EuiHealth usage.

Changes:

  • Removed broad :only-child/:first-child vertical-align rules and replaced them with a specific .euiHealth alignment rule in EuiListItemLayout text styling.
  • Added a new CustomContent Storybook story to exercise various child content patterns, and updated the kitchen sink story labels.
  • Added an upcoming changelog entry describing the visual alignment fix.

Reviewed changes

Copilot reviewed 3 out of 7 changed files in this pull request and generated 2 comments.

File Description
packages/eui/src/components/list_item_layout/_list_item_layout.styles.ts Narrows alignment styling to avoid affecting highlighted text while keeping a targeted EuiHealth alignment fix.
packages/eui/src/components/list_item_layout/_list_item_layout.stories.tsx Adds/updates VRT-only stories to cover custom content and alignment scenarios.
packages/eui/changelogs/upcoming/9669.md Documents the fix in the upcoming changelog.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/eui/changelogs/upcoming/9669.md Outdated
@weronikaolejniczak weronikaolejniczak self-requested a review May 23, 2026 00:25
Comment thread packages/eui/src/components/list_item_layout/_list_item_layout.styles.ts Outdated
Copy link
Copy Markdown
Contributor

@weronikaolejniczak weronikaolejniczak left a comment

Choose a reason for hiding this comment

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

Very simple fix. I can confirm this is working for EuiSelectableTemplateSitewide. No regression to the EuiListItemLayout 👍🏻 🟢

….styles.ts

Co-authored-by: Weronika Olejniczak <32842468+weronikaolejniczak@users.noreply.github.com>
@elasticmachine
Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

cc @mgadewoll

@elasticmachine
Copy link
Copy Markdown
Collaborator

💚 Build Succeeded

History

cc @mgadewoll

@mgadewoll mgadewoll merged commit 9d882b4 into elastic:main May 26, 2026
5 checks passed
acstll added a commit to elastic/kibana that referenced this pull request May 27, 2026
## Dependency updates

- `@elastic/eui` - v116.1.0 ⏩ v116.2.0

---

## Package updates

### @elastic/eui
[`v116.2.0`](https://github.com/elastic/eui/blob/main/packages/eui/changelogs/CHANGELOG_2026.md)

- Added experimental support for always-visible sticky horizontal
scrollbars in `EuiTable`, `EuiBasicTable` and `EuiInMemoryTable` useful
for dense tables that exceed the height of the viewport. This feature is
currently opt-in and can be enabled by setting `stickyScrollbar: true`.
([#9674](elastic/eui#9674))
- Added `significantEvents` glyph to `EuiIcon`
([#9665](elastic/eui#9665))

**Bug fixes**

- Fixed `EuiDataGrid` incorrectly styling disabled `cellActions` icon
buttons and making them look like they were not disabled
([#9672](elastic/eui#9672))
- Fixed a visual misalignment on `EuiSelectableTemplateSitewide` list
items when search terms are highlighted
([#9669](elastic/eui#9669))

**Dependency updates**

- Updated `uuid` to v14.0.0
([#9663](elastic/eui#9663))

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
smith pushed a commit to smith/kibana that referenced this pull request May 27, 2026
## Dependency updates

- `@elastic/eui` - v116.1.0 ⏩ v116.2.0

---

## Package updates

### @elastic/eui
[`v116.2.0`](https://github.com/elastic/eui/blob/main/packages/eui/changelogs/CHANGELOG_2026.md)

- Added experimental support for always-visible sticky horizontal
scrollbars in `EuiTable`, `EuiBasicTable` and `EuiInMemoryTable` useful
for dense tables that exceed the height of the viewport. This feature is
currently opt-in and can be enabled by setting `stickyScrollbar: true`.
([elastic#9674](elastic/eui#9674))
- Added `significantEvents` glyph to `EuiIcon`
([elastic#9665](elastic/eui#9665))

**Bug fixes**

- Fixed `EuiDataGrid` incorrectly styling disabled `cellActions` icon
buttons and making them look like they were not disabled
([elastic#9672](elastic/eui#9672))
- Fixed a visual misalignment on `EuiSelectableTemplateSitewide` list
items when search terms are highlighted
([elastic#9669](elastic/eui#9669))

**Dependency updates**

- Updated `uuid` to v14.0.0
([elastic#9663](elastic/eui#9663))

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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.

4 participants