-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Custom interactions in control styled as a native control #15319
Comments
This custom component was introduced in #9802. Previously, the font size controls were a set of buttons. Worth revisiting this custom implementation in favor of a native |
@afercia do we need design feedback on this since using |
@nicolad I'd say yes, at least some design feedback is necessary. Personally, I'm not sure the size "preview" in the control is really necessary, as the size change can be immediately seen in the block content. Regarding the suggested markup, I'd like to discuss it with the accessibility team. As mentioned also in #15307, related form controls don't necessarily need to be always grouped within a For example, some screen readers repeat the legend for any control in the fieldset. When the control label already contains the words "font size", I don't see a great practical value to also have a legend that says "font size". That would be just repeated the control gets announced, see screenshot below: |
There was a conversation about this in today's Design Triage in slack. While there was a desire to visually represent the actual font sizes in the dropdown, we understand if it causes issues with assistive devices. It doesn't appear that styling the select box options works across browsers to give the same visual appearance. Here's a couple thoughts... 1. Current implementation with added functions 2. Native select box with visual icon 3. Native selectbox only |
Discussed during today's accessibility bug-scrub. Agreed to recommend to change this custom control to a native select element. As per the suggested additional fieldset + legend, sorry I didn't notice the label controls were changed too. That makes sense because the combined text of the legend plus labels would read as:
Even better:
|
As a more long-term approach to this issue, it would be good to add the necessary a11y functions to the custom "select", assuming it is possible and a viable approach. It's a common pattern in many component libraries, and it may be something needed in the future. For example, adding search to the select component for long lists of items. Maybe at that point, it becomes a "dropdown" though, but it still needs to be accessible. |
In the last 3 years, I've gone through most of those "custom selects" and none of them is fully accessible. For a simple reason: they implement non-native, non-standard, behaviors and interactions. The only accessible UI pattern that is close to all these various custom things is the Combo Box pattern. It's different though, more an input field with a list of suggestions rather than a custom select. Gutenberg already has a combo box component (the various auto-completers) and it works pretty well. The point of this issue is to just use a native element rather than adding features to custom components that don't provide full support for browsers APIs and assistive technologies. |
Custom interactions in control styled as a native control
Issue description
In the Block panel, where the font size can be selected, users see what
appears to be a select element. However when keyboard users reach this
component, they cannot use standard keystrokes to change the value, such
as Up-Arrow or Down-Arrow, or Alt+Arrow to open the submenu. Instead,
users need to press Enter to view the submenu.
Keyboard users will expect this control to work the same as a native
select element. Speech recognition users often speak out keystrokes to
perform standard actions on native components, and these would not work
on custom components like these.
Issue Code
Remediation Guidance
Use a native
<select>
element in place of a custom button+submenusetup.
Recommended Code
Relevant standards
(Level A)
Note: This issue may be a duplicate with other existing accessibility-related bugs in this project. This issue comes from the Gutenberg accessibility audit, performed by Tenon and funded by WP Campus. This issue is GUT-68 in Tenon's report
The text was updated successfully, but these errors were encountered: