Skip to content

[EuiSelectable][EuiSelectableList] Fix stale option heights after updates - #9770

Merged
mgadewoll merged 5 commits into
elastic:mainfrom
mgadewoll:selectable/fix-stable-cached-option-height
Jun 30, 2026
Merged

mgadewoll merged 5 commits into
elastic:mainfrom
mgadewoll:selectable/fix-stable-cached-option-height

Conversation

@mgadewoll

@mgadewoll mgadewoll commented Jun 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • What: This PR fixes a bug in EuiSelectableList where some options would be rendered with wrong heights after updates for lists with group titles. Any group title elements that are not the first option element have a larger height (to add a separator), which is cached and then wrongly applied to a search result option, resulting in different heights between options.

  • Why: This was noticed by Cloud-UI in https://github.com/elastic/cloud-ui/issues/3449

  • How:

    • adds a call of this.listRef.resetAfterIndex(0, false) to flush the react-window internal height cache on updates
    • uses shouldForceUpdate=false on resetAfterIndex to prevent an unnecessary duplicate state update
  • The issue was only visible for selectable lists with group titles, and it would only show for options after an update (e.g. due to a search) that would then be placed in the same indexed spot as a previous (non-first element) group title element, which would result in an option being rendered with the cached height of a group title.

API Changes

⚪ No API changes

Screenshots

Before After
Screen.Recording.2026-06-30.at.09.31.31.mov
Screen.Recording.2026-06-30.at.09.31.45.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

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

🧪 To reproduce the issue:

  • open the "With Search and Groups" story (production)
  • type "a" into the search
  • observe that the last option has a larger height (as it's in the same indexed spot as the second group title)

✅ Verify that...

  • all options have the same height when trying to reproduce the issue on this PR (storybook)
  • there are no unexpected regressions with production

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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes a virtualization bug in EuiSelectableList where react-window could reuse cached row heights after option updates (notably when group labels are present), causing non-group options to render at an incorrect height after filtering/searching.

Changes:

  • Reset react-window’s internal size cache on options/visibleOptions updates via resetAfterIndex(0, false) to prevent stale heights.
  • Add a Cypress component test covering grouped selectable search filtering and verifying option row heights remain correct after updates.
  • Add an upcoming changelog entry documenting the bug fix.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
packages/eui/src/components/selectable/selectable_list/selectable_list.tsx Resets VariableSizeList cached item sizes on option updates to prevent stale heights in virtualized grouped lists.
packages/eui/src/components/selectable/selectable.spec.tsx Adds Cypress coverage to reproduce the grouped-search height regression and ensure consistent option heights after filtering.
packages/eui/changelogs/upcoming/9770.md Documents the grouped selectable stale-height bug fix in the upcoming changelog.

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

@elastic-vault-github-plugin-prod

Copy link
Copy Markdown
1 visual difference(s) found - expand to review, then click Approve visual changes to update baselines

euipopover (1 difference)

StoryBeforeAfterDiff
playground desktop

@mgadewoll mgadewoll added the skip-vrt Skips Visual Regression Testing job in CI (clearly state why you're using it in your PR) label Jun 30, 2026
@mgadewoll
mgadewoll marked this pull request as ready for review June 30, 2026 08:55
@mgadewoll
mgadewoll requested a review from a team as a code owner June 30, 2026 08:55
@weronikaolejniczak
weronikaolejniczak self-requested a review June 30, 2026 10:19

@weronikaolejniczak weronikaolejniczak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 🟢 I tested prod vs PR preview, didn't notice any regression.

@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

💚 Build Succeeded

History

cc @mgadewoll

@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

💚 Build Succeeded

History

cc @mgadewoll

@mgadewoll
mgadewoll merged commit fe43122 into elastic:main Jun 30, 2026
1 check passed
mgadewoll added a commit to elastic/kibana that referenced this pull request Jul 17, 2026
## Dependency updates

`@elastic/eui` - v116.5.0 ⏩ v117.0.0

## Changes

- removes temporary custom styles in
`src/core/packages/notifications/browser-internal/src/toasts/global_toast_list.tsx`
(added previously in #273985)
- removes custom icon usages passed via `children` on `EuiCallOut` to
prevent duplication (callouts now have internal default icons per type)
- updates tests and snapshots due to `EuiCallOut` changes

## Package updates

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

- Added `EuiIllustration` for rendering SVG illustrations (e.g. from
`@elastic/eui-illustrations`) that respond to the active EUI color mode
([#9779](elastic/eui#9779))
- Added `compressed` prop to `EuiSearchBar` to enable compact display
mode for the search box and filter buttons
([#9743](elastic/eui#9743))
- Added `addToChat` glyph to `EuiIcon`
([#9768](elastic/eui#9768))
- Updated `EuiCallOut`:
([#9642](elastic/eui#9642))
    - Updated component styles
- Added `text` prop on `EuiCallOut` which renders the main, inline
callout description text - use this instead of `children` where possible
- Added `actionProps` prop on `EuiCallOut` which renders primary and
secondary action buttons
- Added `showErrorTooltip` (defaulting to `true`) to `EuiSearchBar` to
allow consumers to opt-out of the built-in parse-error tooltip
([#9773](elastic/eui#9773))

**Bug fixes**

- Fixed `EuiToast` cutting off absolute positioned content by removing
`overflow: hidden`. ([#9791](elastic/eui#9791))
- Fixed `EuiFlyout` container-scoped flyouts shrinking below usable
widths for named sizes `s` and `m` by applying minimum width floors
derived from theme breakpoints
([#9787](elastic/eui#9787))
- Fixed `EuiSelectable` with group labels rendering options with stale
heights ([#9770](elastic/eui#9770))

**Breaking changes**

- Removed the `accent` variant for `color` on `EuiCallOut`
([#9642](elastic/eui#9642))
patrykkopycinski pushed a commit to patrykkopycinski/kibana that referenced this pull request Aug 5, 2026
## Dependency updates

`@elastic/eui` - v116.5.0 ⏩ v117.0.0

## Changes

- removes temporary custom styles in
`src/core/packages/notifications/browser-internal/src/toasts/global_toast_list.tsx`
(added previously in elastic#273985)
- removes custom icon usages passed via `children` on `EuiCallOut` to
prevent duplication (callouts now have internal default icons per type)
- updates tests and snapshots due to `EuiCallOut` changes

## Package updates

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

- Added `EuiIllustration` for rendering SVG illustrations (e.g. from
`@elastic/eui-illustrations`) that respond to the active EUI color mode
([elastic#9779](elastic/eui#9779))
- Added `compressed` prop to `EuiSearchBar` to enable compact display
mode for the search box and filter buttons
([elastic#9743](elastic/eui#9743))
- Added `addToChat` glyph to `EuiIcon`
([elastic#9768](elastic/eui#9768))
- Updated `EuiCallOut`:
([elastic#9642](elastic/eui#9642))
    - Updated component styles
- Added `text` prop on `EuiCallOut` which renders the main, inline
callout description text - use this instead of `children` where possible
- Added `actionProps` prop on `EuiCallOut` which renders primary and
secondary action buttons
- Added `showErrorTooltip` (defaulting to `true`) to `EuiSearchBar` to
allow consumers to opt-out of the built-in parse-error tooltip
([elastic#9773](elastic/eui#9773))

**Bug fixes**

- Fixed `EuiToast` cutting off absolute positioned content by removing
`overflow: hidden`. ([elastic#9791](elastic/eui#9791))
- Fixed `EuiFlyout` container-scoped flyouts shrinking below usable
widths for named sizes `s` and `m` by applying minimum width floors
derived from theme breakpoints
([elastic#9787](elastic/eui#9787))
- Fixed `EuiSelectable` with group labels rendering options with stale
heights ([elastic#9770](elastic/eui#9770))

**Breaking changes**

- Removed the `accent` variant for `color` on `EuiCallOut`
([elastic#9642](elastic/eui#9642))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-vrt Skips Visual Regression Testing job in CI (clearly state why you're using it in your PR)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants