-
Notifications
You must be signed in to change notification settings - Fork 219
Description
This is sort of a side-issue for #1190, but I'd like to spin it into a separate issue because I think it's a separate side discussion.
I think it would be useful for menuitem elements to support the :open pseudo-class. CSS leaves the per-element definitions to be defined by HTML, so I think is something that would end up purely in the HTML spec.
When thinking about :hover-activation behavior for opening submenus in #1190, I noticed that the styling of menuitems on many existing menus is a little bit interesting, but is representable in CSS if menuitems that open submenus support the :open pseudo-class. In particular, typical styling seems to be:
- if a menulist (or menubar??) has a menuitem whose submenu is open, the menuitem for the open submenu is typically highlighted even if hover has moved elsewhere (for example, during the delay or safe triangle that keeps the submenu open while the mouse has moved elsewhere)
- when there is no open submenu, the highlight style follows
:hover
Additionally, an open submenu typically still retains some sort of highlight styling when the :hover state has moved into a submenu (although at that point the styling is sometimes different from when the pointer is still in the menu).
I think all of these styles are reasonably representable in CSS (sometimes using selectors like menulist:has(> menuitem:open)) if menuitem elements support :open when they trigger submenus. I think :open is a good name for representing this concept and it already exists in CSS, so I think we should use the existing :open pseudo-class here rather than trying to make a new pseudo-class.