Repository navigation
fix(grid): structural styles, scrolling and filter row in a shadow root - 22.3.x - #18098
Open
rkaraivanov wants to merge 2 commits into
Open
rkaraivanov wants to merge 2 commits into
rkaraivanov wants to merge 2 commits into
Conversation
The grid's structural stylesheet was adopted by the document only, so a grid in a shadow root (a custom element or a ShadowDom component) had no layout. IgxStylesRegistrar.register() takes an optional host and also adopts the sheet into the host's shadow root. The grid registers in ngOnInit, once its element is attached, also inside @if or @for. Closes #17859 Part of #18088 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The vertical scroll handler runs after a throttle and the filter row input handler after a debounce. In a shadow root the browser clears the event target when the dispatch ends, so reading event.target threw and the rows did not follow the scrollbar or the filter was not applied. The for-of directives read the scroll element and the filter row reads its input element instead. Closes #17860 Part of #18088 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
rkaraivanov
requested review from
mddragnev and
simeonoff
and
a balanced review from Copilot
December 4, 2026 11:44
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
A pending text-filter debounce can dereference an undefined input and throw if the user switches to a Date or Time column before it expires.
1 open issue
What changed in this PR
Backports shadow-root grid fixes to 22.3.x, supporting the Web Components release needed for shared localization.
Changes:
- Adopts grid structural styles into the containing shadow root.
- Reads scroll and filter values from elements rather than deferred event targets.
- Adds regression coverage and release notes.
| File | Description |
|---|---|
projects/igniteui-angular/test-utils/grid-samples.spec.ts |
Adds a shared shadow-root grid fixture. |
projects/igniteui-angular/grids/grid/src/grid.component.spec.ts |
Tests shadow-root layout and throttled scrolling. |
projects/igniteui-angular/grids/grid/src/grid-filtering-row.spec.ts |
Tests shadow-root filtering. |
projects/igniteui-angular/grids/grid/src/grid-base.directive.ts |
Registers styles during initialization with the grid host. |
projects/igniteui-angular/grids/core/src/filtering/base/grid-filtering-row.component.ts |
Reads the filter input directly. |
projects/igniteui-angular/directives/src/directives/for-of/for_of.directive.ts |
Reads positions from scroll elements. |
projects/igniteui-angular/core/src/services/styles/styles-registrar.service.ts |
Adds host-aware shadow-root stylesheet adoption. |
projects/igniteui-angular/core/src/services/styles/styles-registrar.service.spec.ts |
Covers host-aware registration. |
projects/igniteui-angular-elements/src/app/custom-strategy.spec.ts |
Tests grid styles inside an Elements shadow root. |
CHANGELOG.md |
Documents the fixes and registrar API extension. |
Review effort: Balanced
| const target = (eventArgs as InputEvent).target as HTMLInputElement; | ||
| // Read the input, not the event target: the debounced call runs after the dispatch, when the browser | ||
| // has cleared the target of an event in a shadow tree. | ||
| const target = this.input.nativeElement; |
This branch has not been deployed
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 #17859, closes #17860
Description
IgxStylesRegistrar.register()takes an optionalhost. The sheet is still adopted by the document. Whenhost.getRootNode()is aShadowRootthat does not have the sheet yet, the same sheet is adopted by that shadow root too.IgxGridBaseDirectiveregisters its structural sheet inngOnInitwith its element, instead of in the constructor without one.retain()stays in the constructor.IgxForOfDirective.onScroll/onHScrollandIgxGridForOfDirective.onScrollread the scroll position from their scroll element instead ofevent.target.IgxGridFilteringRowComponentreads its input element instead ofevent.targetwhen the debounced input is handled.Motivation / Context
This is the port of # to
22.3.x. The code is the same as in themasterpull request.igniteui-webcomponents-grids7.4, which usesigniteui-i18n-core2, is built from this line, so this port is the one that #18088 needs.IgxStylesRegistraradopted the grid's structural sheet by the document only, so a grid in a shadow root had no layout.event.targetafter the dispatch, when the browser has set it tonullfor an event in a shadow tree.One conflict was resolved in
grid.component.spec.ts: this branch has no "transitions of the cell content" block, so only the new "in a shadow root" block was added there. The changelog entries are under22.3.2.Type of Change (check all that apply):
Component(s) / Area(s) Affected:
Grid, Tree Grid, Hierarchical Grid, Pivot Grid,
igxFor,IgxStylesRegistrar, ElementsHow Has This Been Tested?
The same new specs as in the
masterpull request. Each one fails without the fix:scrollTopon the scroll element.Runs on this branch, with the
node_modulesof its own lock file:igxForspecs: 2387 of 2387;igniteui-angular-elements: 96 of 96;Test Configuration:
Checklist:
CHANGELOG.MDupdates for newly added functionality🤖 Generated with Claude Code