Skip to content

[menu] Consider reusing <menu> and <nav> HTML elements #1194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
domfarolino opened this issue Apr 15, 2025 · 2 comments
Open

[menu] Consider reusing <menu> and <nav> HTML elements #1194

domfarolino opened this issue Apr 15, 2025 · 2 comments
Labels
menu Menu elements proposal

Comments

@domfarolino
Copy link
Collaborator

Instead of introducing a brand new elements like <menubar> element, we could consider reusing <menu> for the regular, non-navigation menubar example referenced by ARIA's authoring practices: https://www.w3.org/WAI/ARIA/apg/patterns/menubar/examples/menubar-editor/. This would need to be done with some sort of opt-in (much like appearance: base-select does for the existing <select> element, to make it customizable), which could either be in CSS or an HTML attribute. We could also maybe consider reusing <nav> for the navigation bar use case, but this is related to #1193.

It seems nice to reuse these elements if possible, just because they have nice short names and we'd be adding less new clutter to the platform, but I think there are tradeoffs, and discussing this with WHATWG folks will be important as time passes.

@domfarolino domfarolino added the menu Menu elements proposal label Apr 15, 2025
@lukewarlow
Copy link
Collaborator

lukewarlow commented Apr 15, 2025

Does it actually need any opt in?

Can't it just be that its role is menu when it contains a new menuitem element? Likewise deal with rendering changes based on this too menu:has(menuitem)?

Also I think we'd be using menu instead of a new menulist rather than it being lieu of menubar right?


Based on the fact menuitem did actually exist as an element at one point (I was only aware of menu), my above comment won't work.

@aardrian
Copy link

Understand that the APG menu pattern is aspirational. APG was created only to show idealized ARIA-only patterns (which were grounded in Microsoft Windows behaviors and interaction methods). That big warning box at the top of the page is both a signal not to use them as-is and also the best I could get them to add once people treated these like a specification or best practice. APG should not be used as the basis for new elements.

Instead I suggest looking at:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
menu Menu elements proposal
Projects
None yet
Development

No branches or pull requests

3 participants