You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug(aria/combobox): ComboboxPopup throws NG0950 when destroyed before its first change detection #33972
Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
No response
Description
ComboboxPopup.ngOnDestroy calls this.combobox()._unregisterPopup(). The combobox input is input.required(). If the view that holds the popup is destroyed before its first update pass, the input was never set, and reading it throws NG0950: Input "combobox" is required but no value is available yet. Angular reports this as "Error during cleanup of component", and in tests it fails the test ("1 fixture threw errors during cleanup").
This happens in any unit test that creates a component containing a combobox and does not run change detection before teardown, for example a plain "should create" test, or a test that only checks providers.
Destroying the popup without a first change detection does nothing (there is nothing to unregister).
Actual Behavior
NG0950: Input "combobox" is required but no value is available yet, from ComboboxPopup.ngOnDestroy (src/aria/combobox/combobox-popup.ts, line 67 on main).
A possible fix: register in ngOnInit and keep the registered combobox in a field, then unregister that field (if set) in ngOnDestroy, instead of reading the input again.
Workaround: wrap the ng-template ngComboboxPopup in @if (combobox) { … }, so the popup is only created in an update pass.
Environment
Angular: 22.2.1
CDK/Material: @angular/cdk 22.2.3, @angular/aria 22.2.3 (also in 22.3.0-next.2 and main)
Browser(s): any (seen in Vitest with happy-dom)
Operating System (e.g. Windows, macOS, Ubuntu): macOS
Activity