Skip to content

fix(toggle-animation): remove collapsed content before animation reset - #17965

Open
teodosiah wants to merge 5 commits into
masterfrom
thristodorova/fix-17964
Open

teodosiah wants to merge 5 commits into
masterfrom
thristodorova/fix-17964

Conversation

@teodosiah

@teodosiah teodosiah commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Closes #17964

Description

Motivation / Context

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

Component(s) / Area(s) Affected:

How Has This Been Tested?

  • Unit tests
  • Manual testing
  • Automated e2e tests

Test Configuration:

  • Angular version:
  • Browser(s):
  • OS:

Screenshots / Recordings

Checklist:

  • All relevant labels 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

Copilot AI balanced review requested due to automatic review settings November 11, 2026 11:49

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.

🟡 Changes recommended

A regression test is missing for synchronous body removal before animation reset, and existing collapse tests also pass with the old behavior, leaving the flicker unguarded.

1 open issue
What changed in this PR

This PR addresses #17964 by rendering expansion-panel collapse synchronously to prevent flicker in zoneless apps, including accordion and banner components built on the panel.

Changes:

  • Replaces markForCheck() with detectChanges() after collapse.
  • Adds a comment explaining why the body must be removed before the close-animation player resets.
File Description
projects/​igniteui-angular/​expansion-panel/​src/​expansion-panel/​expansion-panel.component.ts Makes collapse rendering synchronous to prevent a full-height flash after animation.

Review effort: Balanced

@teodosiah teodosiah added the ❌ status: awaiting-test PRs awaiting manual verification label Nov 11, 2026
@teodosiah
teodosiah requested a review from mddragnev November 11, 2026 12:31

@mddragnev mddragnev left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems to be a more general issue. The tree and the vertical stepper have the same issue. Might be better to fix this in the AnimationPlayer instead.

teodosiah and others added 2 commits November 12, 2026 11:46
The expansion panel, tree and stepper removed their collapsed content
only on the next render, after the animation player was reset or
destroyed. The content was then painted in place for a frame, e.g. in
zoneless applications.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@teodosiah teodosiah changed the title fix(expansion-panel): render collapse synchronously to avoid flicker fix(toggle-animation): remove collapsed content before animation reset Nov 12, 2026
@teodosiah
teodosiah requested a review from mddragnev November 12, 2026 12:28
if (!(type === ANIMATION_TYPE.OPEN ? this.openInterrupted : this.closeInterrupted)) {
targetEmitter.emit();
}
if (type === ANIMATION_TYPE.CLOSE && !this._toggleAnimationDestroyed) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

animationEnd subscription has takeUntil so this might never be invoked with toggleAnimationDestroyed set to true. I dont think you need that flag here.

this.animationPosition = 0;
this.newDuration = 0;
this.leaveAnimationDone.emit();
if (!this._animationOwnerDestroyed) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also redudant. From my understanding this is a guard to skip a change detection cycle if an animation is already destroyed but something else triggers it. Angular has alread marked the view destroyed and thus, cdr.detectChanges() is no-op.
Just leave a comment why this detectChanges is needed.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Expansion panel, accordion, banner, stepper and tree flicker on collapse in zoneless apps

4 participants