Skip to content

bug(menu): ERROR RuntimeError: NG0100: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value for 'mat-menu-panel-animating': 'true'. Current value: 'false'. Expression location: _MatMenu component. #31933

@anisabboud

Description

@anisabboud

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

Image

Reproduction

[class.mat-menu-panel-animating]="_isAnimating"

protected _onAnimationDone(state: string) {
const isExit = state === EXIT_ANIMATION;
if (isExit || state === ENTER_ANIMATION) {
if (isExit) {
clearTimeout(this._exitFallbackTimeout);
this._exitFallbackTimeout = undefined;
}
this._animationDone.next(isExit ? 'void' : 'enter');
this._isAnimating = false;
}
}
protected _onAnimationStart(state: string) {
if (state === ENTER_ANIMATION || state === EXIT_ANIMATION) {
this._isAnimating = true;
}
}

Expected Behavior

_isAnimating should probably be a signal (since it's used in the template), or _changeDetectorRef would need to be notified to avoid the console warning.

Actual Behavior

NG0100: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked.
Previous value for 'mat-menu-panel-animating': 'true'. Current value: 'false'.
Expression location: _MatMenu component.

Environment

  • Angular: 20.3.2 (latest)
  • CDK/Material: 20.2.5 (latest)
  • Browser(s): Chrome 140
  • app.config.ts providers include:
        provideCheckNoChangesConfig({ interval: 1000, exhaustive: true }),  // For debugging zoneless locally https://angular.dev/guide/zoneless#debug-mode-check-to-ensure-updates-are-detected.

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/menu

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions