test(dropdown): Add zoneless test for virtual dropdown#17374
Open
mddragnev wants to merge 3 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes NG0100 ExpressionChangedAfterItHasBeenCheckedError for virtualized IgxDropDownComponent in zoneless Angular by stabilizing the aria-activedescendant computation during virtual scroll updates.
Changes:
- Cached
aria-activedescendant(_activeDescendantId) for virtualized DropDown instead of computing it via livechildrenlookups during CD. - Updated the cache on virtual chunk loads and key navigation paths.
- Added a zoneless regression test for “select item → scroll” in the virtualized DropDown suite.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| projects/igniteui-angular/drop-down/src/drop-down/drop-down.component.ts | Introduces cached active-descendant id for virtual mode; updates cache on chunk load/navigation to avoid NG0100 in zoneless CD. |
| projects/igniteui-angular/drop-down/src/drop-down/drop-down.component.spec.ts | Adds a zoneless regression test covering select + scroll scenario. |
| projects/igniteui-angular/combo/src/combo/combo-dropdown.component.ts | Removes redundant local _activeDescendantId field now that base DropDown provides it. |
Comment on lines
344
to
348
| this.skipHeader(direction); | ||
| }); | ||
| } else { | ||
| this._activeDescendantId = this.children.find(e => e.index === index)?.id ?? null; | ||
| this.skipHeader(direction); |
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.
Closes #17322
Description
Fixes ExpressionChangedAfterItHasBeenChecked errors in the virtualized
IgxDropDownComponentwhen running in zoneless Angular applications.Motivation / Context
aria-activedescendantwas computed on-the-fly via a@HostBindinggetter. For virtual scroll, thefocusedItemgetter performed a livechildren.find(...)DOM query. When a virtual scroll chunk updated (either via keyboard navigation or manual scrollbar scroll), the childrenQueryListchanged during a CD pass, causing the getter to return a different value between Angular's main pass and the dev-mode stability check. In zoneless mode — where each CD pass is independent and strict — this reliably throws. In zone-based mode, NgZone coalesces async mutations so the error is masked.Type of Change (check all that apply):
Component(s) / Area(s) Affected:
How Has This Been Tested?
Test Configuration:
Screenshots / Recordings
Checklist:
feature/README.MDupdates for the feature docsREADME.MDCHANGELOG.MDupdates for newly added functionalityng updatemigrations for the breaking changes (migrations guidelines)