Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Feature (MatDialog): Add an option to prevent duplicate dialogs

クローズ
#34,005 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
angular, typescript
領域
frontend

調査の方向性

Start by reading the MatDialog API and its existing openDialogs and getDialogById() behavior. The proposal leaves key behavior undecided, including whether to return the existing reference or ignore the request, and how duplicate detection should be customized. Done criteria would need maintainers to settle those choices and define how component type matching works.

索引モデルが issue の本文から書いたものです。

説明

area: material/dialog feature gemini-triaged needs triage
Feature Description

Currently, Angular Material’s MatDialog allows the same component to be opened multiple times, resulting in multiple instances of the same dialog being displayed simultaneously.

In some applications, this behavior is undesirable. For example, repeated user interactions or multiple event emissions can accidentally open the same dialog more than once.

Developers must currently implement their own duplicate detection logic using MatDialog.openDialogs or MatDialog.getDialogById() before calling MatDialog.open().

Proposed solution

It would be useful to have a built-in option in MatDialogConfig to prevent duplicate instances of the same component from being opened.

For example:

this.dialog.open(MyDialogComponent, {
preventDuplicates: true,
});

When this option is enabled, attempting to open a component that already has an open dialog could either:

  • Return the existing MatDialogRef without creating another instance.
  • Ignore the new request and keep the existing dialog open.

The exact behavior could be determined by the maintainers.

Ideally, duplicate detection would be scoped to the component type, with an option to customize the behavior if needed.

Benefits

  • Avoids accidentally opening multiple instances of the same dialog.
  • Reduces repetitive boilerplate across applications.
  • Provides a consistent, framework-level solution.
  • Keeps applications simpler and less error-prone.

Alternatives considered

Currently, developers can manually inspect openDialogs or use getDialogById() before opening a dialog. However, this requires additional application-level logic and does not provide a straightforward, reusable option for this common use case.

Would this feature be a good fit for Angular Material’s MatDialog API? I’d be happy to contribute a PR if the maintainers consider this approach appropriate.

Use Case

No response

主要言語
TypeScript
スター
25k
フォーク
6.8k
平均マージ
3日 7時間
マージ済み PR(30日)
59

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

angular/components のほかの issue

angular/components の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。