A goal of <selectmenu> is that it is accessible by default.
The way this will be achieved is that when an author provides their own instances of the <selectmenu>'s predefined parts (button, listbox, and options), the platform will ensure that they have the correct a11y semantics by applying appropriate ARIA roles and specifying relationships like aria-haspopup="listbox".
Ensuring that the <selectmenu> is fully accessible becomes more difficult when the author adds arbitrary interactive content via the <selectmenu>’s named slots, particularly inside the listbox part. Adding, for example, extra buttons inside the listbox is problematic because ARIA and accessibility tech doesn’t expect to find interactive content in a listbox aside from the options themselves. See the content restrictions of the listbox role.
Through extensions to ARIA, accessibility tech, and <selectmenu> controller code, it may eventually be possible to make some or all of these scenarios accessible by default. In particular, see the aria-actions may eventually provide a mechanism for supporting interactive content inside of listbox options.
In the meantime, to guide developers away from creating inaccessible scenarios, I'm proposing that <selectmenu> emit a console warning when an author slots any interactive content into the <selectmenu> (aside from the elements designated as button, listbox, and option parts). “Interactive content” for this purpose is defined as any of:
- Form controls
- Any other element that users are expected to interact with, e.g.
<a href>, <summary>/<details>, <video>, others...
<iframe>
- Anything given focusability via tabindex, e.g.
<div tabindex="0">.
We could also consider more restrictive enforcement of this, such as making the <selectmenu> inoperable if interactive content is present. This is likely overkill though. There are some scenarios where interactive content can exist without breaking the control for AT users, for example the Scroll Indicators demo here. If we completely prevent devs from using <selectmenu> for these types of scenarios, they will build these scenarios with <div>s (as is the case today) without any a11y support and without console messages to warn them about potential a11y issues.
This was previously discussed in the context of <listbox> at #458, but I want to scope the discussion here to specifically interactive content. We're exploring other potential ways for handling accessibility of noninteractive content like optgroup headers -- more to come on that later.
A goal of
<selectmenu>is that it is accessible by default.The way this will be achieved is that when an author provides their own instances of the
<selectmenu>'s predefined parts (button, listbox, and options), the platform will ensure that they have the correct a11y semantics by applying appropriate ARIA roles and specifying relationships likearia-haspopup="listbox".Ensuring that the
<selectmenu>is fully accessible becomes more difficult when the author adds arbitrary interactive content via the<selectmenu>’s named slots, particularly inside the listbox part. Adding, for example, extra buttons inside the listbox is problematic because ARIA and accessibility tech doesn’t expect to find interactive content in a listbox aside from the options themselves. See the content restrictions of the listbox role.Through extensions to ARIA, accessibility tech, and
<selectmenu>controller code, it may eventually be possible to make some or all of these scenarios accessible by default. In particular, see the aria-actions may eventually provide a mechanism for supporting interactive content inside of listbox options.In the meantime, to guide developers away from creating inaccessible scenarios, I'm proposing that
<selectmenu>emit a console warning when an author slots any interactive content into the<selectmenu>(aside from the elements designated as button, listbox, and option parts). “Interactive content” for this purpose is defined as any of:<a href>,<summary>/<details>,<video>, others...<iframe><div tabindex="0">.We could also consider more restrictive enforcement of this, such as making the
<selectmenu>inoperable if interactive content is present. This is likely overkill though. There are some scenarios where interactive content can exist without breaking the control for AT users, for example the Scroll Indicators demo here. If we completely prevent devs from using<selectmenu>for these types of scenarios, they will build these scenarios with<div>s (as is the case today) without any a11y support and without console messages to warn them about potential a11y issues.This was previously discussed in the context of
<listbox>at #458, but I want to scope the discussion here to specifically interactive content. We're exploring other potential ways for handling accessibility of noninteractive content like optgroup headers -- more to come on that later.