open-ui icon indicating copy to clipboard operation
open-ui copied to clipboard

[menu] Consider reusing `<menu>` and `<nav>` HTML elements

Open domfarolino opened this issue 7 months ago • 2 comments
trafficstars

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 https://github.com/openui/open-ui/issues/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 avatar Apr 15 '25 21:04 domfarolino

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.

lukewarlow avatar Apr 15 '25 21:04 lukewarlow

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:

aardrian avatar Apr 17 '25 16:04 aardrian

There hasn't been any discussion on this issue for a while, so we're marking it as stale. If you choose to kick off the discussion again, we'll remove the 'stale' label.

github-actions[bot] avatar Oct 15 '25 00:10 github-actions[bot]