Skip to content

[css-ui] Add or reuse pseudo-element for openable-submenu indicator (triangle) #13430

@dbaron

Description

@dbaron

We're doing work to add elements to HTML that represent menus (see explainer and PR). The initial work is for application menus, though we hope to follow that with similar work covering navigation menus, which would probably reuse many aspects of the design (including this choice of pseudo-element).

One issue we have is how to style the marker that indicates that a menu item opens a submenu. This is typically a triangular marker at the right side, such as the one next to "Zoom" in this screenshot from the explainer:
A menubar with an open View menu.  The first item in the View menu is a Zoom submenu, which is also open.  The Zoom submenu's label has a rightward pointing triangle at the right edge of the View menu, pointing to the Zoom submenu.

I think there are a few different options for how to style this, and we should choose one. The main options I see are:

  1. Use ::after.
    • Pro: Matches the way a developer would typically have built this themselves if it weren't a platform feature.
    • Con: Uses something that maybe should be left for web developers to use rather than being part of a platform feature.
  2. Use ::marker.
    • Pro: Matches what we do for <details>/<summary> which is styled as a list-item and thus has a similar expansion triangle (although at the inline-start edge).
    • Con: Basically all other uses of ::marker show up at the beginning rather than the end (for list items and for <details>/<summary>)
  3. Create a new pseudo-element.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions