Skip to content

[menu] Distinguish checkable attribute values #1520

Open

Description

@Crissov

The behavioral semantics of checkable=single seem pretty clear: The user selects one out of a group of options and only that one applies.
The only common variation is whether checking the checked item again unchecks it because a selection for this group is optional; this could be conveyed by the existing required attribute.
(Rechecking can sometimes also reverse the effect of the option, e.g. toggle between ascending and descending in sort controls.)

For the other proposed value, checkable=multiple, however, there are at least two common meanings, which might need to be distinguished:

  • Cumulative or additive: all checked entries apply.
    • Rarely, the order of checking them matters, e.g. multi-level sorting.
  • Alternative: any of the checked entries applies, i.e. one must and more may apply.

This is relevant in filter controls, for instance, which can be part of application menus, but also appear in other contexts.

There are also examples – though none in application menus that I can think of, but in forms and questionnaires – where the minimum of checkable entries is neither 0 nor 1 or where the maximum is neither 1 nor all. Alas, I have never seen a design that conveyed such constraints well.

I therefore suggest to reconsider the number and selection of values for this attribute.

Example

<menulist id=list-view-menu>

  <fieldset checkable=single>
    <legend>Group by</legend>
    <menuitem defaultchecked>none</menuitem>
    <submenu id=group-presence>
      <menuitem>Date added</menuitem>
      <menulist id=date-group>
        <menuitem default>adaptive</menuitem>
        <menuitem>Year</menuitem>
        <menuitem>Month</menuitem>
        <menuitem>Week</menuitem>
        <menuitem>Day</menuitem>
        <menuitem>Event</menuitem>
      </menulist>
    </submenu>
    <submenu id=group-age>
      <menuitem>Date created</menuitem>
      <menulist ref=date-group/>
    </submenu>
    <menuitem>Creator</menuitem>
    <menuitem>Owner</menuitem>
  </fieldset>

  <fieldset checkable=rank>
    <legend>Sort by</legend>
    <submenu toggle id=sort-name>
      <menuitem>Name</menuitem>
      <menulist>
        <fieldset checkable=single>
          <menuitem title="A…Z">ascending</menuitem>
          <menuitem title="A…z">ascending, case-sensitive</menuitem>
          <menuitem title="Z…A">descending</menuitem>
          <menuitem title="Z…a">descending, case-sensitive</menuitem><!--z…A?-->
        </fieldset>
        <menuitem>locale rules</menuitem>
      </menulist>
    </submenu>
    <submenu id=sort-presence>
      <menuitem>Date added</menuitem>
      <menulist>
        <fieldset checkable=toggle>
          <menuitem title="ancient items first">ascending</menuitem>
          <menuitem title="recent items first">descending</menuitem>
        </fieldset>
      </menulist>
    </submenu>
    <submenu toggle id=sort-age>
      <menuitem>Date created</menuitem>
      <menulist>
        <menuitem title="older items first">ascending</menuitem>
        <menuitem title="newer items first">descending</menuitem>
      </menulist>
    </submenu>
    <submenu toggle id=sort-edition>
      <menuitem>Date changed</menuitem>
      <menulist>
        <menuitem title="stale items first">ascending</menuitem>
        <menuitem title="fresh items first">descending</menuitem>
      </menulist>
    </submenu>
  </fieldset>

  <fieldset checkable=multiple>
    <legend>Filter by</legend>
    <menuitem>hidden</menuitem>
    <menuitem>flagged</menuitem>
    <submenu id=filter-color>
      <menuitem>Base color</menuitem>
      <menulist>
        <fieldset checkable=any>
          <menuitem>black</menuitem>
          <menuitem>red</menuitem>
          <menuitem>green</menuitem>
          <menuitem>blue</menuitem>
          <menuitem>yellow</menuitem>
          <menuitem>violet</menuitem>
          <menuitem>gray</menuitem>
          <menuitem>white</menuitem>
        </fieldset>
      </menulist>
    </submenu>
  </fieldset>

</menulist>

PS: This may be related to #1189.

Activity

  1. dbaron commented on Sep 28, 2026

    @dbaron
    Collaborator

    Could you give an example of an existing application menu system that supports additional distinctions here, and describe what changes as a result of them? Your example uses five values of checkable, three of which seem to be multiple and variants (rank, any), and two of which seem to be single and a variant (toggle). But it also uses some of them (single, rank, and multiple) on submenus, and our current proposal doesn't support checkable submenus, nor am I aware of existing menu systems that have checkable submenus.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions