Skip to content

fix(tabs): call markForCheck after each Promise.resolve().then() - 21.2.x - #17746

Open
igdmdimitrov wants to merge 2 commits into
21.2.xfrom
dmdimitrov/fix-17676-21.2.x
Open

igdmdimitrov wants to merge 2 commits into
21.2.xfrom
dmdimitrov/fix-17676-21.2.x

Conversation

@igdmdimitrov

Copy link
Copy Markdown
Contributor

Closes #17676

Type of Change (check all that apply):

  • Bug fix
  • New functionality
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactoring (no functional changes)
  • Documentation
  • Demos
  • CI/CD
  • Tests
  • Changelog
  • Skills/Agents

How Has This Been Tested?

  • Unit tests
  • Manual testing
  • Automated e2e tests

Checklist:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code (test guidelines)
  • This PR includes API docs for newly added methods/properties (api docs guidelines)
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes (migrations guidelines)
  • This PR includes behavioral changes and the feature specification has been updated with them
  • Accessibility (ARIA, keyboard navigation, focus management) has been verified

@igdmdimitrov
igdmdimitrov requested a review from mddragnev October 7, 2026 13:16
Copilot AI balanced review requested due to automatic review settings October 7, 2026 13:16

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.

Copilot review overview

🟡 Changes recommended

The new spec has an invalid import and class assertion, and collection-change paths lack zoneless coverage.

Review effort: Balanced
Findings: 2 High severity · 1 Low severity

Open (3)
What changed in this PR

Fixes zoneless tab selection rendering by scheduling change detection after deferred updates.

Changes:

  • Calls markForCheck() after deferred tab selection updates.
  • Adds a zoneless regression test.
  • Documents the fix in the changelog.
File Description
tabs.directive.ts Schedules change detection after deferred selection updates.
tabs.component.spec.ts Adds zoneless initial-selection coverage.
CHANGELOG.md Records the tabs bug fix.

import { TestBed, fakeAsync, tick, waitForAsync } from '@angular/core/testing';
import { IgxTabItemComponent } from './tab-item.component';
import { IgxTabsAlignment, IgxTabsComponent } from './tabs.component';
import { IgxTabHeaderComponent } from './header/tab-header.component';
// reflected in the DOM even though nothing else triggers change detection.
expect(tabs.selectedIndex).toBe(0);
expect(tabs.selectedItem.selected).toBeTrue();
expect(firstHeader.classList.contains('igx-tab-header--selected')).toBeTrue();
// Set the selected index to the tab that has selected=true
Promise.resolve().then(() => {
this.selectedIndex = selectedIndex;
this._cdr.markForCheck();
@igdmdimitrov igdmdimitrov added 🛠️ status: in-development Issues and PRs with active development on them and removed ❌ status: awaiting-test PRs awaiting manual verification labels Oct 7, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🛠️ status: in-development Issues and PRs with active development on them tabs version: 21.2.x

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants