bug(aria/combobox): ComboboxPopup throws NG0950 when destroyed before its first change detection
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 78/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- angular, typescript
- Área
- accessibility, frontend
Línea de trabajo
Empieza en src/aria/combobox/combobox-popup.ts, especialmente en ngOnDestroy, y revisa el registro del ciclo de vida y el comportamiento de teardown del componente. Reproduce el problema con la prueba proporcionada, que crea un fixture y lo destruye sin ejecutar la detección de cambios. El objetivo se cumple cuando el teardown deja de leer un input obligatorio sin establecer y la prueba pasa.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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
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.
Reproduction
import { Component } from '@angular/core';
import { TestBed } from '@angular/core/testing';
import { Combobox, ComboboxPopup, ComboboxWidget } from '@angular/aria/combobox';
import { Listbox, Option } from '@angular/aria/listbox';
@Component({
imports: [Combobox, ComboboxPopup, ComboboxWidget, Listbox, Option],
template: `
<div ngCombobox #combobox="ngCombobox" tabindex="0">Pick one</div>
<ng-template ngComboboxPopup [combobox]="combobox">
<div ngListbox ngComboboxWidget #listbox="ngListbox" focusMode="activedescendant"
[activeDescendant]="listbox.activeDescendant()">
<div ngOption value="alpha" label="alpha">alpha</div>
</div>
</ng-template>
`,
})
class Repro {}
it('destroys cleanly before the first change detection', () => {
const fixture = TestBed.createComponent(Repro);
expect(() => fixture.destroy()).not.toThrow(); // throws NG0950
});
Expected Behavior
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
- Lenguaje dominante
- TypeScript
- Estrellas
- 25k
- Forks
- 6.8k
- Merge medio
- 1 d 7 h
- PR fusionados (30 d)
- 69
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de angular/components
-
bug(aria/combobox): keys pressed back to back are lost; only the last one reaches the popupPosiblemente ocupada @drakeo338 la tomó hoy. Abiertoarea: aria/combobox gemini-triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
angular/components#33973 ·
Los mantenedores suelen responder en 1 día
-
bug(material/sort): hover hint arrow on an unsorted header shows the active sort direction, not the resulting direction after click.Posiblemente ocupada @lekhmanrus la tomó hace 12 días. Abiertoarea: material/sort P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
angular/components#33933 ·
Los mantenedores suelen responder en 1 día
-
bug(mat-date-picker): month shown twice in date pickerPosiblemente ocupada @PreethiPantangi la tomó hace 30 días. Abiertoarea: material/datepicker P4
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
angular/components#33763 · 2 comentarios · 3 reacciones ·
Los mantenedores suelen responder en 1 día
-
Bug in table.scss footer cell height: unset instead of footer row height unsetPosiblemente ocupada @minwookshin la tomó hace 16 días. Abiertoarea: material/table P4
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
angular/components#33709 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
docs-bug(Table): Add example with `rowspan`Posiblemente ocupada @BHUVANSH855 la tomó hace 97 días. Abiertoarea: material/table docs P4
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
angular/components#33455 ·
Los mantenedores suelen responder en 1 día
Todos los issues de angular/components
Issues similares
-
area: repo priority: P2 type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
appandflow/stim#4107 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Dificultad 1/5 1-3 horas Aptitud para principiantes 60/100
lingdojo/kana-dojo#32859 · 1 comentario · 5 reacciones ·
Los mantenedores suelen responder en 1 día
-
code-quality refactoring
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
github/gh-aw-firewall#10364 ·
Los mantenedores suelen responder en 1 día
-
Merge the duplicate kaffir_corn record into sorghumPosiblemente ocupada @Crypto-Shroom la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
Crypto-Shroom/Bird-Feed-Calculator#322 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
drizzle-team/drizzle-orm#6552 ·
Los mantenedores suelen responder en 2 días