Skip to content

feat(ui5-table-virtualizer): support variable row heights - #14308

Open
aborjinik wants to merge 6 commits into
mainfrom
table-virtualizer-2
Open

aborjinik wants to merge 6 commits into
mainfrom
table-virtualizer-2

Conversation

@aborjinik

@aborjinik aborjinik commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Background

The existing virtualizer requires one fixed height for all rows.
This does not accommodate wrapped text, expanded details, resized columns or content arriving asynchronously.
This change supports content-based row heights while retaining native scrolling, shared table-column alignment and application-owned rendering.

What changed

  • Measure rendered rows with ResizeObserver and cache heights by logical row index.
  • Estimate unseen rows using the average of measured content rows, with estimatedRowHeight as the initial hint.
  • Replace row-count-based extraRows with pixel-based overscan.
  • Add scrollToIndex with Start, Center, End and Nearest alignment.
  • Keep keyboard navigation and focus consistent across recycled rows and delayed application rendering.
  • Add experimental TableRow.loading placeholders. Their heights use the estimate and are excluded from the average.
  • Add variable-height and simple mobile demos, renderer comparisons, and explanatory presentations with playback controls.
  • Update documentation, React playground types and Cypress tests.
  • Mark newly introduced APIs with @since 2.30.0.

Important implementation decisions

Efficient height calculations
Two Fenwick trees store height sums and stored-row counts. Position lookup and height updates take O(log n); changing the shared estimate does not require updating every unseen row.

Stable visible content
Measurement corrections are absorbed into a drift offset. The rendered block moves inside the existing table grid, preserving column alignment.
Drift reconciliation uses native scrollend, with boundary handling for the first and last rows. No custom scroll physics are introduced.

Large data sets
The physical scroll range is capped at 16 million pixels. Larger logical ranges are mapped into that physical range.

Application-owned rows
The application still handles range-change and renders a contiguous, ascending range. The virtualizer does not create or bind application rows.
The demos retain connected positional pools where state-preserving DOM moves are unavailable. Pool mode uses moveBefore where supported.

Loading versus uncovered areas
TableRow.loading means data is unavailable. The separate static empty-area fallback covers areas awaiting rendered content; it does not set loading=true. Local-data demos render directly without a server delay.

Usage example

<ui5-table overflow-mode="Scroll" style="height: 400px">
  <ui5-table-virtualizer
    slot="features"
    row-count="10000"
    estimated-row-height="80"
    overscan="400">
  </ui5-table-virtualizer>

  <!-- Header and application-rendered rows -->
</ui5-table>

Handle range-change by rendering first through last - 1, setting each row's position to its logical index. Rows may have different heights.
Set loading=true only when a row's data is unavailable, keeping its cells in place. Once data arrives, populate the cells and clear loading.
Use scrollToIndex(5000, "Start") to navigate to a logical row. Call reset() after inserting, removing or reordering the underlying data.

Validation

Physical-device and cross-browser CI validation remain important.
Extreme scrollbar jumps can still expose the empty-area fallback.
The changes do not guarantee a particular FPS on every device.

Breaking change

Rhe experimental rowHeight and extraRows properties are removed.

  • Replace rowHeight / row-height with estimatedRowHeight / estimated-row-height.
    This is an initial hint, not an enforced fixed height.
  • Replace extraRows / extra-rows with overscan, measured in pixels.

Demo

@github-actions

Copy link
Copy Markdown

👋 Heads-up: dev close is in effect

Thanks for the contribution! This repository is currently in dev close ahead of release 2.30 (scheduled 2027-01-14, UTC). See the release schedule for the full timeline.

This PR appears to introduce public-API changes (detected by diffing the Custom Elements Manifest against the latest published version on npm):

@ui5/webcomponents

  • ➕ added interface: ITableFeature
  • ➕ added interface: ITableGrowing
  • ➕ added property: loading
  • ➕ added attribute: loading
  • ➕ added property: estimatedRowHeight
  • ➕ added property: overscan
  • ➕ added method: scrollToIndex
  • ➕ added attribute: estimated-row-height
  • ➕ added attribute: overscan
  • ➖ removed property: extraRows
  • ➖ removed property: rowHeight
  • ➖ removed attribute: extra-rows
  • ➖ removed attribute: row-height

Could you please hold off on merging into main until the release ships? Public-API changes are best landed in the next dev cycle so they don't slip into the release at the last minute. Once the release is out, this PR is good to go.

If this change must ship in the current release, please request a review from one or two members of @UI5/ui5-team-webc so the team can sign off explicitly.

💬 False positive? If you believe this PR doesn't actually change the public API (e.g. only internal refactoring, or an entry the detector mis-attributed), please reply on this thread — your feedback helps us improve the detection during this trial run.

Posted automatically by the Dev Close Notice workflow.

1 similar comment
@github-actions

Copy link
Copy Markdown

👋 Heads-up: dev close is in effect

Thanks for the contribution! This repository is currently in dev close ahead of release 2.30 (scheduled 2027-01-14, UTC). See the release schedule for the full timeline.

This PR appears to introduce public-API changes (detected by diffing the Custom Elements Manifest against the latest published version on npm):

@ui5/webcomponents

  • ➕ added interface: ITableFeature
  • ➕ added interface: ITableGrowing
  • ➕ added property: loading
  • ➕ added attribute: loading
  • ➕ added property: estimatedRowHeight
  • ➕ added property: overscan
  • ➕ added method: scrollToIndex
  • ➕ added attribute: estimated-row-height
  • ➕ added attribute: overscan
  • ➖ removed property: extraRows
  • ➖ removed property: rowHeight
  • ➖ removed attribute: extra-rows
  • ➖ removed attribute: row-height

Could you please hold off on merging into main until the release ships? Public-API changes are best landed in the next dev cycle so they don't slip into the release at the last minute. Once the release is out, this PR is good to go.

If this change must ship in the current release, please request a review from one or two members of @UI5/ui5-team-webc so the team can sign off explicitly.

💬 False positive? If you believe this PR doesn't actually change the public API (e.g. only internal refactoring, or an entry the detector mis-attributed), please reply on this thread — your feedback helps us improve the detection during this trial run.

Posted automatically by the Dev Close Notice workflow.

@sap-ui5-webcomponents-release

Copy link
Copy Markdown

…scrolling

Replace fixed-height calculations with measured row heights so wrapped
text, expanded details and asynchronously loaded content can be
virtualized without losing the reader's position.

Keep height lookup and updates logarithmic with two Fenwick trees:
one sums stored heights, the other counts stored rows. Unseen rows use
a shared estimate updated only after the measured sample doubles and
changes meaningfully. Placeholder measurements do not affect it.

Absorb measurement corrections in a drift offset and move one rendered
block inside the shared table grid. Reconcile with native scrollend,
with boundary handling for the first and last rows. Cap the physical
scroll range at 16 million pixels for larger data sets. Keep native
scrolling rather than introducing custom scroll physics.

Track keyboard focus by logical row and column, including recycled
elements and delayed application rendering. Preserve shared column
alignment and base alternating colors on the logical row position.

Add experimental TableRow.loading placeholders with estimated heights,
hidden cell content, aria-busy and suppressed row activation. Actual
loading rows use a reduced-motion-aware CSS pulse; uncovered areas use
a separate static, viewport-sized fallback and do not set row.loading.

Keep applications responsible for creating and binding their rows.
Render the half-open range [first, last) in ascending position order.
For example:

  <ui5-table-virtualizer slot="features" row-count="10000"
    estimated-row-height="80" overscan="400">
  </ui5-table-virtualizer>

On range-change, render rows first through last - 1 with position set.
Use loading=true only while their data is unavailable, and keep their
cells. Use scrollToIndex(5000, "Start") to navigate to a logical row.
Call reset() after inserting, removing or reordering the data.

Add local-data and variable-height demos, renderer comparisons and
long/short explanatory stories. Reuse connected positional pools on
mobile; use state-preserving Pool moves only where moveBefore exists.
Size demo reserves from measured estimates and retain their high-water
marks. Include Pause/Play and Replay on the long story's animations.

Update migration samples, editor API types and Cypress coverage for
variable heights, anchoring, loading, recycling and asynchronous focus.
Mark the newly introduced APIs as available since 2.30.0.

BREAKING CHANGE: remove the experimental rowHeight and extraRows
properties. Replace rowHeight/row-height with
estimatedRowHeight/estimated-row-height as a hint, not a fixed size.
Replace extraRows/extra-rows with overscan measured in pixels.
Expose estimatedRowHeight, overscan and TableRow.loading in the React
playground types so the migrated virtualization sample no longer uses
stale fixed-height API declarations.
Restore the generated Monaco declarations to their upstream state.
Keep the variable-height virtualizer, samples and runtime behavior unchanged.
Initialize the demo pages through async functions so the production
bundle supports the configured ES2020 and browser targets.

Keep component readiness checks and synchronous range rendering intact.
Report initialization failures explicitly.
Measure pop-in and positioned group rows in the internal scroll viewport.
Reuse GridWalker navigation to preserve the cell column across group headers,
including delayed rendering, while retaining focus recovery for recycled rows.

Keep rowHeight and extraRows as deprecated migration aliases, with explicit
new properties taking precedence. Add independent demo controls and stable,
type-aware recycling without introducing a group-text slot API.

This branch was previously deployed

1 inactive deployment
netlify-preview — 424b505d Deployed Dec 1, 2026 by nnaydenow via deploy-preview #3909
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.

3 participants