-
Notifications
You must be signed in to change notification settings - Fork 3.1k
[Draft] Introduce the new menu elements #12011
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
base: main
Are you sure you want to change the base?
Conversation
Note there are a couple open questions in the form of TODOs. For example: 1. Should `popovertargetaction` be allowed to target `<menulist>` elements? Probably, but it could use discussion. 2. Should the attribute change steps that react to `popover` attribute mutations "work" on `<menulist>` elements? This effectively makes the explicit `popover` attribute work on `<menulist>` elements, possibly overriding their default popover behavior. This could also use more discussion. (My preference would be to ignore `popover` on `<menulist>` for now).
This commit moves the command/commandfor attributes into their own section,
since they're general to both buttons and menuitem elements. The next steps are:
1. Pull out a shared activation behavior algorithm from the button element,
that defines the command-invoking parts that the two elements have in common
2. Add the three new commands
3. Define the menuitem element, and any menuitem-specific things for the
commands
These are copied from the main button activation steps's popover handling steps
| <p><dfn><code>menuitem</code> element inner content elements</dfn> are the elements which are | ||
| allowed as descendants of <code>menuitem</code> elements.</p> | ||
|
|
||
| <p>The following are <span><code>option</code> element inner content elements</span>:</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<span><code>option</code>
↓
<span><code>menuitem</code>
| <dt><span data-x="concept-element-contexts">Contexts in which this element can be used</span>:</dt> | ||
| <dd>Where <span>flow content</span> is expected.</dd> | ||
| <dt><span data-x="concept-element-content-model">Content model</span>:</dt> | ||
| <dd>Zero or more <code>menuitem</code> elements.</dd> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Zero or more menuitem elements.
↓
Zero or more menulist element inner content elements.
| <dt><span data-x="concept-element-content-model">Content model</span>:</dt> | ||
| <dd>Zero or <span><code>menuitem</code> element inner content elements</span>.</dd> | ||
| <dt><span data-x="concept-element-attributes">Content attributes</span>:</dt> | ||
| <dd><span>Global attributes</span></dd> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "command" & "commandfor" attribute should be added .
| <dl class="element"> | ||
| <dt><span data-x="concept-element-categories">Categories</span>:</dt> | ||
| <dd><span><code>menulist</code> element inner content elements</span>.</dd> | ||
| <dd>If the element's children include at least one <code>menuitem</code> element: <span>Palpable content</span>.</dd> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can menuitem element be placed inside menuitem element?
| <dd>As a descendant of a <code>menubar</code> element.</dd> | ||
| <dd>As a descendant of a <code>menulist</code> element.</dd> | ||
| <dt><span data-x="concept-element-content-model">Content model</span>:</dt> | ||
| <dd>Zero or <span><code>menuitem</code> element inner content elements</span>.</dd> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<dd>Zero or <span>
↓
<dd>Zero or more <span>
| padding-block: 0; | ||
| padding-inline: 0; | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that it seems necessary to add CSS of "menulist > fieldset > legend".
|
The menubar element & the menulist element is "Interactive content"? The menubar element & the menulist element should be added to section of "3.2.5.2.2 Flow content" & "3.2.5.2.8 Palpable content". In section of "4.4.19 The div element";
In section of "4.10.15 The fieldset element";
In section of "4.4.2 The hr element";
The section of "15.3.12 The fieldset and legend elements" also apply to fieldset & legend elements who is descendant of a menulist element? |
|
In section of "4.4.10 The menuitem element"; In section of "4.4.2 The hr element"; ↓should change In section of "4.10.15 The fieldset element"; ↓should change |
| } | ||
|
|
||
| menulist { | ||
| display: flex; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the menulist element is exactly a "native" popover, shouldn't the default of initial state of the menulist element be "display:none"?
At least, the following should be added.
menulist:not(:popover-open) {
display:none;
}
|
In section of "4.10.16 The legend element";
|
| border-radius: 0.25em; | ||
| padding: 0.25em; | ||
| } | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The following should be added;
menubar[orientation="vertical"] {
flex-direction: column;
}
This PR introduces the
<menubar>,<menulist>, and<menuitem>elements as they appear in Open UI's menu elements proposal: https://open-ui.org/components/menu.explainer/. This includes their integration with popovers, command invokers,<fieldset>and checkability, default styles, and variant default styles for the<menulist>element depending on how it is rendered. What has not been spec'd yet is:orientationattribute's effect on default styles and keyboard navigability<menulist>popovers). But to be consistent with customizable select, we're not planning on specifying the exact keyboard behavior for getting from one menulist to another in a menubar, or traversing through menu items in a menu bar or list. These will be covered by examples, notes, and.optionalWPTscheckedevent integration discussed in What event should fire on checkable menu items? openui/open-ui#1321akey to focus the first menuitem in a menulist that starts with the charactera)This PR is only a draft. It's suitable for stage 2 evaluation of the menu elements proposal tracked by #11729, but has rough edges and non-trivial TODOs. The API shape is just about fully expressed though.
(See WHATWG Working Mode: Changes for more details.)
/dom.html ( diff )
/form-elements.html ( diff )
/grouping-content.html ( diff )
/index.html ( diff )
/indices.html ( diff )
/infrastructure.html ( diff )
/interaction.html ( diff )
/interactive-elements.html ( diff )
/obsolete.html ( diff )
/popover.html ( diff )
/rendering.html ( diff )
/semantics-other.html ( diff )