Skip to content

bug(mat-select): Panel null on openedChange #30596

@angelaki

Description

@angelaki

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

19.1

Description

With the old version this code used to work / the panel never was null:

@ViewChild(MatSelect) matSelect: MatSelect;

ngAfterViewInit(): void {
    this.matSelect.openedChange.subscribe(opened => {
        if (opened) {
            console.log(this.matSelect.panel);
            setTimeout(() => console.log(this.matSelect.panel), 0);
        }
    });
}

Since 19.2 the panel is null until the timeout occurs. I've noticed this behavior using ng-mat-select-infinite-scroll (HaidarZ/ng-mat-select-infinite-scroll#57).

Reproduction

Code provided above.

Expected Behavior

panel should never be empty if openedChange is called.

Actual Behavior

panel is null.

Environment

Angular CLI: 19.2.1
Node: 22.11.0
Package Manager: pnpm 10.5.2
OS: win32 x64

Angular: 19.2.1
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
... service-worker

Package Version

@angular-devkit/architect 0.1902.1 (cli-only)
@angular-devkit/build-angular 19.2.1
@angular-devkit/core 19.2.1 (cli-only)
@angular-devkit/schematics 19.2.1 (cli-only)
@angular/cdk 19.2.2
@angular/material 19.2.2
@angular/material-luxon-adapter 19.2.2
@schematics/angular 19.2.1 (cli-only)
rxjs 7.8.2
typescript 5.8.2
zone.js 0.15.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triageThis issue needs to be triaged by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions