Skip to content

feat: Added virtualization component#2222

Open
rkaraivanov wants to merge 22 commits into
masterfrom
rkaraivanov/virtualization
Open

feat: Added virtualization component#2222
rkaraivanov wants to merge 22 commits into
masterfrom
rkaraivanov/virtualization

Conversation

@rkaraivanov

Copy link
Copy Markdown
Member

Description

Added virtualization component

NOTE: There is still work to be done around the default styles and the style(sheet) integration
around the theming stack/usage of the component in other shadow roots.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that causes existing functionality to change)
  • Documentation update
  • Refactoring (code improvements without functional changes)

Checklist

  • My code follows the project's coding standards
  • I have tested my changes locally
  • I have updated documentation if needed
  • Breaking changes are documented in the description

Copilot AI review requested due to automatic review settings July 21, 2026 14:10

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

Introduces a new igc-virtual-scroll component to provide in-house list virtualization and wires it into the Combo component to replace the previous @lit-labs/virtualizer-based implementation.

Changes:

  • Added a new virtualization engine + igc-virtual-scroll component, along with Storybook stories and unit tests.
  • Updated Combo to use igc-virtual-scroll for its dropdown list (types, navigation behavior, styles, and tests updated accordingly).
  • Improved test stability/logging by centralizing ResizeObserver-loop suppression and filtering benign null browser logs in web-test-runner output.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
web-test-runner.config.mjs Adds a custom reporter to filter benign null browser logs before the default reporter runs.
stories/virtual-scroll.stories.ts New Storybook stories demonstrating vertical/horizontal, variable size, and remote-data virtualization scenarios.
src/index.ts Exports the new virtual scroll component and its public types/events.
src/components/virtualization/virtualization.ts New igc-virtual-scroll Lit component integrating the engine, measurements, scrolling API, and events.
src/components/virtualization/virtualization.spec.ts New tests for accessibility, events, public API, engine integration, and RTL behavior.
src/components/virtualization/types.ts Defines public types: item context, state snapshot, and data request payload.
src/components/virtualization/engine.ts New virtualization math engine (Fenwick tree/BIT-based sizing + visible-range computations).
src/components/common/utils.spec.ts Adds shared suppressResizeObserverLoopError() helper for tests.
src/components/combo/types.ts Switches Combo render-function typing to use the new virtual scroll item template type.
src/components/combo/themes/combo.base.scss Adjusts list sizing styles to work with the new virtual scroll list element.
src/components/combo/controllers/navigation.ts Updates scrolling behavior to use scrollToIndex() instead of scrollIntoView().
src/components/combo/combo.ts Replaces igc-combo-list with igc-virtual-scroll and adapts rendering/theming integration.
src/components/combo/combo.spec.ts Updates Combo tests to await virtual scroll layoutComplete and query the new list element.
src/components/combo/combo-list.ts Removes the old LitVirtualizer-based igc-combo-list component.
src/components/chat/chat.spec.ts Uses the shared ResizeObserver-loop suppression helper.

Comment thread src/components/virtualization/engine.ts
Comment thread src/components/virtualization/virtualization.ts Outdated
Comment thread src/components/virtualization/virtualization.ts Outdated
Comment thread stories/virtual-scroll.stories.ts Outdated
Copilot AI review requested due to automatic review settings July 21, 2026 15:26
@ChronosSF

Copy link
Copy Markdown
Member

@rkaraivanov , I am noticing a potentially faulty behavior. So I added a virtualization combo story (with opus, we can remove it later) in the storybook with some controls. When navigating by index, the item, while in the rendered frame is actually not in the view frame.

You can reproduce it by either scrolling to the middle with the button or by searching for a specific item.

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

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

Comments suppressed due to low confidence (2)

src/components/virtualization/virtualization.ts:309

  • aria-hidden="true" on the track element hides all rendered items from the accessibility tree (including when the host is used as a role="listbox" in combo), which can make options undiscoverable to screen readers.
      <div part="igc-vs-track" style=${styleMap(trackStyle)} aria-hidden="true">

src/components/virtualization/virtualization.ts:473

  • scrollToIndex() accepts ScrollIntoViewOptions, but it forwards those options into Element.scrollTo(), which expects ScrollToOptions. This is already causing callers to pass block: 'center', which has no effect and is misleading.
  /** Programmatically scrolls to the specified item index. */
  public scrollToIndex(index: number, options?: ScrollIntoViewOptions): void {
    const offset = this._engine.getScrollOffsetForIndex(index);

Comment thread src/components/combo/controllers/navigation.ts
@rkaraivanov
rkaraivanov marked this pull request as ready for review July 22, 2026 06:42
…rollToIndex

Fix VirtualScrollEngine's BIT.findIndexAtOffset returning idx - 1,
which could resolve to the wrong item near large scroll offsets.

scrollToIndex now iteratively re-aligns the scroll position after
waiting for the scroll to settle and layout to complete, correcting
for the gap between estimated and measured item sizes until the
offset stabilizes. This fixes scrolling landing past the requested
index in large lists (e.g. combo's virtualized dropdown) before all
items in between have been measured.

Adds a scroll request id so overlapping scrollToIndex calls no longer
race each other, and removes a stray aria-hidden on the track element.

Add tests covering index alignment with under-estimated item sizes,
including a large-list smooth-scroll scenario.
Copilot AI review requested due to automatic review settings July 22, 2026 06:50
@rkaraivanov

Copy link
Copy Markdown
Member Author

@ChronosSF
This should be fixed with the latest commit.

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

Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.

Comment thread src/components/virtualization/virtualization.ts
Comment thread src/components/virtualization/virtualization.ts
Comment thread src/components/virtualization/virtualization.ts
Comment thread src/components/virtualization/virtualization.ts
Comment thread src/components/virtualization/engine.ts

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

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

Comment thread src/components/virtualization/virtualization.ts Outdated
Comment thread src/components/virtualization/virtualization.ts
Comment thread src/components/common/utils.spec.ts
Copilot AI review requested due to automatic review settings July 22, 2026 08:02

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

Copilot reviewed 17 out of 17 changed files in this pull request and generated 4 comments.

Comment thread src/components/virtualization/engine.ts Outdated
Comment thread src/components/common/util.ts Outdated
Comment thread src/components/common/utils.spec.ts Outdated
Comment thread src/components/virtualization/virtualization.ts
Copilot AI review requested due to automatic review settings July 22, 2026 08:37

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

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

Comments suppressed due to low confidence (1)

src/components/common/util.ts:60

  • Typo in the asNumber JSDoc example: asNUmber should be asNumber so the snippet is copy/pasteable.
 * asNUmber('five', 5); // 5

Comment thread src/components/virtualization/types.ts
Comment thread src/components/combo/combo.ts
Copilot AI review requested due to automatic review settings July 22, 2026 10:04

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

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

Comments suppressed due to low confidence (1)

src/components/common/util.ts:60

  • Doc example has a typo (asNUmber) which could confuse users and breaks copy/paste usage. Please correct it to asNumber.
 * asNUmber('five', 5); // 5

Comment thread src/components/virtualization/types.ts Outdated
Copilot AI review requested due to automatic review settings July 22, 2026 10:13

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

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

Comment thread web-test-runner.config.mjs
Comment thread src/components/virtualization/virtualization.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants