feat(aria/menu): Add possibility to create a shared menu component from aria/menu
Los mantenedores suelen responder en 1 día
@ok7sai ya está trabajando en esto.
Desde el 1/4/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Feature Description
When building a menu using aria/menu you have to have the following structure:
- an for cdkConnectedOverlay
- a container element with ngMenu
- another for ngMenuContent
- only then the actual ngMenuItem elements
This results in 4 structural levels that need to be repeated every time you need a new menu.
I attempted to create a shared menu component (similar to Angular Material’s MatMenu) in order to reduce this complexity to 2 levels and enable an API like:
<button appMenuTrigger #appMenuTrigger="appMenuTrigger" [appMenu]="appMenu.formatMenu()">
Open Menu
</button>
<app-menu #appMenu [appMenuTrigger]="appMenuTrigger">
<app-menu-item value="Mark as read">
<span class="icon material-symbols-outlined" aria-hidden="true">mark_email_read</span>
<span class="label">Mark as read</span>
</app-menu-item>
<app-menu-item value="Snooze">
<span class="icon material-symbols-outlined" aria-hidden="true">snooze</span>
<span class="label">Snooze</span>
</app-menu-item>
</app-menu>
Internally, app-menu wraps Menu and MenuContent:
@Component({
selector: 'app-menu',
imports: [OverlayModule, Menu, MenuContent],
template: `
<ng-template
[cdkConnectedOverlayOpen]="appMenuTrigger().menuTrigger.expanded()"
[cdkConnectedOverlay]="{ origin: appMenuTrigger().nativeElement, usePopover: 'inline' }"
[cdkConnectedOverlayPositions]="overlayPositions"
cdkAttachPopoverAsChild>
<div ngMenu class="menu" #formatMenu="ngMenu">
<ng-template ngMenuContent>
<ng-content />
</ng-template>
</div>
</ng-template>
`
})
export class AppMenu {
appMenuTrigger = input.required<AppMenuTrigger>();
formatMenu = viewChild<Menu<string>>('formatMenu');
overlayPositions: ConnectedPosition[] = [{originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4}];
}
and menu items are wrapped like this:
@Component({
selector: 'app-menu-item',
template: '<ng-content />',
hostDirectives: [{ directive: MenuItem, inputs: ['value: value'] }]
})
export class AppMenuItem {}
Problem
With this approach, accessibility breaks (keyboard navigation no longer works correctly). This seems to happen because Menu cannot properly register MenuItem children when they are content projected.
Proposed enhancement
Expose a public API on Menu that allows the menu to "refresh" in order to register the items when they are content projected.
Use Case
No response
- Lenguaje dominante
- TypeScript
- Estrellas
- 25k
- Forks
- 6.8k
- Merge medio
- 1 d 5 h
- PR fusionados (30 d)
- 67
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 Un pull request vinculado a esta issue está abierto o ya se fusionó. 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(aria/combobox): ComboboxPopup throws NG0950 when destroyed before its first change detectionPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoarea: aria/combobox gemini-triaged
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
angular/components#33972 ·
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 29 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
Todos los issues de angular/components
Issues similares
-
Sequências em espanhol: «Atualizado em», a aba «Fila» e o valor 'pause' ainda saem em portuguêsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
melgarafael/DeskcommCRM#3104 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
🐛 [Bug] Mobile: on the login and registration pages the footer sits below the visible screenAbiertobug service: webapp
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Ocelot-Social-Community/Ocelot-Social#10684 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
nicobailon/pi-subagents#2978 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
getsentry/sentry-conventions#732 · 1 comentario ·
Los mantenedores suelen responder en 1 día