Repository navigation
Conversation
|
👋 Since this is a community submitted pull request, a Buildkite build has not been started automatically. Would an Elastic organization member please verify the contents of this pull request and kick off a build manually? |
sravanth-space
marked this pull request as ready for review
November 24, 2026 11:59
Make the virtualized outer and inner element types stable module-level components fed by context so react-window no longer remounts the `<code>` tree on every render. Spread react-window's style after `codeProps` so a consumer `style` cannot clear the list's block size.
sravanth-space
force-pushed
the
code-block-virtualized-stable-elements-v2
branch
from
November 24, 2026 14:08
25ac049 to
33554da
Compare
Merge a consumer `style` into the inner `<code>` instead of letting it overwrite react-window's list style. A consumer `width`/`inlineSize` replaces the list's inline size. A consumer `height`, `blockSize` or min/max block size is ignored so the scroll range is kept, and react-window's `pointerEvents` wins while scrolling.
eokoneyo
self-requested a review
November 27, 2026 11:53
eokoneyo
reviewed
Nov 27, 2026
eokoneyo
left a comment
Contributor
There was a problem hiding this comment.
Hey @sravanth-space your changes LGTM, I've just left some improvements we can make.
Contributor
Author
Hi @eokoneyo Thanks for the review. I just pushed the refactors. Please have a look. |
eokoneyo
approved these changes
Nov 27, 2026
Contributor
|
buildkite test this |
💚 Build Succeeded
|
💚 Build Succeeded
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
memo(forwardRef(...))components, fed by contextstyleinto the inner<code>without letting it override react-window's list sizeCloses #10251
Why are we making this change?
EuiCodeBlockVirtualizedbuilt both element types inuseMemo. The inner one depended oncodePropsandlabel, which change identity on every render, so react-window remounted the<code>tree on each update (flicker, lost text selection).Following the review in #10251, the inner
<code>now putscodePropsfirst and react-window's style after it. Before, a consumerstyleoverwrote react-window'sblock-size, collapsing the scroll range so rows past the first few were unreachable. Non-conflicting consumer styles (e.g.padding) are kept. A consumerheight,width,blockSizeorinlineSizeis ignored, since react-window owns the list size, and react-window'spointerEventswins while scrolling. I left the outer<pre>order unchanged: react-window passesclassName={undefined}, so spreading it afterprePropswould dropeuiCodeBlock__pre.Screenshots
No visual change. Measured in Chrome with a virtualized block that gets one new line per second for 13 s, plus a 200-row block with
style={{ padding: 0 }}andoverflowHeight={100}:main)<code>element replacedImpact to users
🟢 No changes required on the consumer side.
QA
General checklist
Updated visual regression tests🤖 Generated with Claude Code