Feature (MatDialog): Add an option to prevent duplicate dialogs
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 5/5
- Tempo estimado
- Mais de uma semana
- Facilidade para iniciantes
- 35/100
- Tipo de issue
- Funcionalidade
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- angular, typescript
- Domínio
- frontend
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
- Linguagem predominante
- TypeScript
- Estrelas
- 25k
- Forks
- 6.8k
- Merge médio
- 3d 1h
- PRs com merge (30d)
- 69
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de angular/components
-
bug(aria/accordion): Enter/Space inside a panel toggles the accordion instead of activating the focused elementTalvez já em andamento @agarwalU001 assumiu hoje. Abertaarea: aria/accordion gemini-triaged needs triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
angular/components#34011 ·
Mantenedores costumam responder em até 1 dia
-
bug(aria/combobox): keys pressed back to back are lost; only the last one reaches the popupTalvez já em andamento @drakeo338 assumiu há 6 dias. Abertaarea: aria/combobox gemini-triaged
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
angular/components#33973 ·
Mantenedores costumam responder em até 1 dia
-
bug(material/sort): hover hint arrow on an unsorted header shows the active sort direction, not the resulting direction after click.Talvez já em andamento @lekhmanrus assumiu há 18 dias. Abertaarea: material/sort P3
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 70/100
angular/components#33933 ·
Mantenedores costumam responder em até 1 dia
-
bug(mat-date-picker): month shown twice in date pickerTalvez já em andamento @PreethiPantangi assumiu há 35 dias. Abertaarea: material/datepicker P4
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
angular/components#33763 · 2 comentários · 3 reações ·
Mantenedores costumam responder em até 1 dia
-
Bug in table.scss footer cell height: unset instead of footer row height unsetTalvez já em andamento @minwookshin assumiu há 22 dias. Abertaarea: material/table P4
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 88/100
angular/components#33709 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
Todas as issues de angular/components
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 62/100
Merit-Systems/x402scan#1312 ·
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
Mantenedores costumam responder em até 1 dia
-
Native Web
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 80/100
digitalfabrik/integreat-app#4517 ·
Mantenedores costumam responder em até 2 dias
-
TLS guide repeats certs/ in the certificate directoryTalvez já em andamento @maheshrijal assumiu hoje. Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
prometheus/docs#3156 ·
Mantenedores costumam responder em até 2 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 83/100
medusajs/dtc-starter#90 ·
Mantenedores costumam responder em até 1 dia