bug(aria/combobox): ComboboxPopup throws NG0950 when destroyed before its first change detection
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- angular, typescript
調査の方向性
src/aria/combobox/combobox-popup.ts、特に ngOnDestroy から調べ、コンポーネントのライフサイクル登録とteardownの動作を確認してください。fixtureを作成し、変更検知を実行せずに破棄する提供済みのテストで再現してください。teardownで未設定の必須inputを読み取らなくなり、テストが通れば完了です。
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- TypeScript
- スター
- 25k
- フォーク
- 6.8k
- 平均マージ
- 1日 7時間
- マージ済み PR(30日)
- 69
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
angular/components のほかの issue
-
bug(aria/combobox): keys pressed back to back are lost; only the last one reaches the popup対応中かも @drakeo338 が 1 日前に担当しました。 オープンarea: aria/combobox gemini-triaged
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
angular/components#33973 ·
メンテナーはふだん 1 日以内に返信
-
bug(material/sort): hover hint arrow on an unsorted header shows the active sort direction, not the resulting direction after click.対応中かも @lekhmanrus が 12 日前に担当しました。 オープンarea: material/sort P3
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
angular/components#33933 ·
メンテナーはふだん 1 日以内に返信
-
bug(mat-date-picker): month shown twice in date picker対応中かも @PreethiPantangi が 30 日前に担当しました。 オープンarea: material/datepicker P4
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
angular/components#33763 · コメント 2 件 · リアクション 3 件 ·
メンテナーはふだん 1 日以内に返信
-
Bug in table.scss footer cell height: unset instead of footer row height unset対応中かも @minwookshin が 16 日前に担当しました。 オープンarea: material/table P4
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
angular/components#33709 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
docs-bug(Table): Add example with `rowspan`対応中かも @BHUVANSH855 が 97 日前に担当しました。 オープンarea: material/table docs P4
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
angular/components#33455 ·
メンテナーはふだん 1 日以内に返信
angular/components の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
mobile-next/mobile-mcp#526 ·
メンテナーはふだん 1 日以内に返信
-
e2e-failure ready-to-code
難易度 1/5 1時間未満 初心者へのやさしさ 73/100
redhat-developer/rhdh-plugin-export-overlays#4470 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
anthropics/anthropic-sdk-typescript#1273 ·
メンテナーはふだん 10 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
CopilotKit/OpenBot#815 ·
メンテナーはふだん 1 日以内に返信