-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Form controls are neither grouped nor named #15307
Comments
This was discussed in today's #core-editor triage session (link requires registration): https://wordpress.slack.com/archives/C02QB2JS7/p1557754759136400 Focus of the discussion was on form fields, not the issue with redundant label tracked already at #11747. It was discussed whether this could be programmatically enforced as a best-practice from the abstraction of a component (existing, new, or as a prop in configuring an existing component). Two common components were identified:
Question: Is it fair to say the groupings should only be implemented when multiple inputs exist for the same "label" group? Assuming the answer to the above is "Yes":
|
Note: I kept the "Needs Accessibility Feedback" on this issue because I'd like to propose to discuss it during next accessibility meeting. Some of the raised concerns make sense to me e.g.: not all the rendered elements would need to be grouped in a |
Discussed during today's accessibility bug scrub. As a general considerations, there were concerns on how to address this programmatically. Most of the times the need for a fieldset and legend really depends on the content. Example from https://accessibility.blog.gov.uk/2016/07/22/using-the-fieldset-and-legend-elements/ Do you need a passport?
In this case, a fieldset + legend are clearly necessary and benefit all users. In other cases, see for example the screenshot below, grouping form fields in a fieldset + legend wouldn't be so appropriate. It could also make things worse, as in adding redundant or incorrect information: In this example, users already know they're in the “Latest Posts Settings”. They have selected the Latest Posts Settings block and navigated to its settings. Some screen readers repeat the legend for each form control. Hearing “Latest Posts Settings” repeated for each form control within this group wouldn't help at all. |
Considering the specific examples "Font Size", "Background Color", "Text Color" (the latter two are the same underlying component), they are implemented as: Each uses Some common factors which could be used for programmatic determination to consider rendering as a
Or, this could be made explicit, as in considered in my previous comment with a In reflecting on the introduction of |
I do realize that, from a developer perspective, programmatically determining the way components are rendered and their behavior is desirable. However, this shouldn't happen because of development convenience and at the expenses of users experience. It really depends on the content. I doubt there's a good way to programmatically address this issue based on the amount of controls. Adding semantics just for the sake of... having more semantic elements doesn't always help 🙂 It's really about how semantics is communicated by assistive technologies and ultimately perceived by users who use that software. We shouldn't try do add semantics when it can potentially make things worse. Please allow me to explain how screen readers announce In accessibility terms, a Not surprisingly, there are inconsistencies across browser/screen reader combos 🙂 Theoretically, the Add to that it also depends on the navigation mode. Some combos announce the legend only when tabbing through form controls (ie. when screen readers are in "forms mode". Instead, they don't when navigating content with the arrows (in "browse mode"). Some screen readers don't even announce "grouping" or "group". That said, let's use your Poster Image example
When tabbing, this would be announced (more or less) in the following way. Please consider this varies across different combos. In the best case:
In the worst case (with repetition of the legend):
In both cases the point is: what is the actual value of hearing the legend "Poster Image" when the controls labels already refer to "Poster Image"? That's a useless repetition. It doesn't add value and there's really nothing else My point is that it really depends on how the legend and labels text is crafted. There's no way to programmatically determine the quality of the text developers will use for these components. Consider this other example: If the text "General" was a fieldset legend, what the added value would be? The checkboxes labels are already clear:
As a user, hearing "General" in addition to that wouldn't help me at all. We could argue that "General" is not a good term to start with 🙂 but regardless, it's again about the actual combination of text used for the fieldset legend and the controls labels. Instead, in this other example: I'd definitely agree that "Document Panels" should be a fieldset legend. Otherwise, when tabbing through the checkboxes, I would hear only:
and have no clue what they refer to. E.g. what is this "Permalink" checkbox, what it does? No clue. Hearing "Document Panels" as name of the group would help me understand what the checkboxes do. Aside: we could argue that the text "Document Panels" could be improved: there's no verb, what is the underlying action? It should be something like "Enable Document Panels". Ultimately, it's more about language and communication. Thinking at the fieldset legend + the form controls in terms of question and answers may help. I don't think this can be addressed programmatically. It's about education and crafting good combinations of text. I'd be more in favor of allowing developers to make conscious, educated, choices by the means of a Then, the correct usage of |
Could it not be viewed as an issue of labels, where the text of "Select Poster Image" ought to be simplified anyways as being redundant (both visually in text and as announced by accessible technology) with its grouping "Poster Image"? Otherwise, a reading of the referenced resource could reinforce the assumptions of "single" (radio as exception) vs. "several" as the differentiator in how to apply The other examples cited are not what I had in mind as being in scope to the considerations of my prior comment, as they are neither today nor presumably ought to be implemented as a single
Is the concern of added value here the fact more in the fact that "General" is a meaningless categorization? And if so, is that not again (to your point) an issue of the label, and not of its specific usage?
My goal is not convenience, but in seeking ways for tools to complement and serve to promote education, to prevent these mistakes from being allowed to be made. If it's not possible do so here, then fair enough. But I'd not want to be discouraged in exploring where these opportunities might exist. |
Sure, in fact my point is really about the combination of the legend text and the labels text. In the poster image example, the following would make more sense:
From the referenced resource I'd rather take the point of considering this in terms of question and answers, where the However, my concern is that all this is more related to the actual text developers will use. How can we ensure developers will get it right? In my experience, when there's room for abusing some code intended usage, it will be abused. 🙂 Trying to programmatically determine this relies on assumptions that we can't guarantee will be true. Also, how we can guarantee developers will group together controls that are logically related? What if they group unrelated controls and a fieldset + legend are rendered anyways? I'm sorry but my intent is not discouraging explorations. However, I already know, because I saw it happening many, many, times, that strong assumptions on intended usage will inevitably lead to incorrect usage and a degraded experience for users. |
If/when a design change proposed last week in issue #470 is implemented, that would be better than this. However, here is a quick fix option for the Status and Visibility section, in case it's good enough for the next maintenance release. The label tags are removed in favor of Tenon's h3 heading recommendation (removing margin and bold styles) and non-visual text is added to the button (using text strings that are already translated) for a little context. If someone wants to make a pull request based on this, I made these edits to the following 3 files in a testing environment. \packages\edit-post\src\components\sidebar\post-visibility\index.js <PanelRow className="edit-post-post-visibility">
<h3>{ __( 'Visibility' ) }</h3>
{ ! canEdit && <span><PostVisibilityLabel /></span> }
{ canEdit && (
<Dropdown
position="bottom left"
contentClassName="edit-post-post-visibility__dialog"
renderToggle={ ( { isOpen, onToggle } ) => (
<Button
type="button"
aria-expanded={ isOpen }
className="edit-post-post-visibility__toggle"
onClick={ onToggle }
isLink
>
<span className="screen-reader-text">{ __( 'Visibility:' ) } </span><PostVisibilityLabel /><span className="screen-reader-text"> { __( 'Click to change' ) }</span>
</Button>
) }
renderContent={ () => <PostVisibilityForm /> }
/>
) }
</PanelRow> \packages\edit-post\src\components\sidebar\post-schedule\index.js <PanelRow className="edit-post-post-schedule">
<h3>{ __( 'Publish' ) }</h3>
<Dropdown
position="bottom left"
contentClassName="edit-post-post-schedule__dialog"
renderToggle={ ( { onToggle, isOpen } ) => (
<>
<Button
id={ `edit-post-post-schedule__toggle-${ instanceId }` }
type="button"
className="edit-post-post-schedule__toggle"
onClick={ onToggle }
aria-expanded={ isOpen }
aria-live="polite"
isLink
>
<span className="screen-reader-text">{ __( 'Publish:' ) } </span><PostScheduleLabel /><span className="screen-reader-text"> { __( 'Click to change' ) }</span>
</Button>
</>
) }
renderContent={ () => <PostScheduleForm /> }
/>
</PanelRow> \packages\edit-post\src\components\sidebar\style.scss .edit-post-post-status h3 {
margin: 0;
font-weight: 400;
} |
Regarding modifying It would be nice to have sub-issues for addressing each specific set of controls this issue relates to. Are we waiting to decide on a global approach to then split up into tasks? I'd love to work on this but this is a pretty scary ticket to pick up as a new dev on the project! 😅 |
Form controls are neither grouped nor named
Issue description
In the Settings dropdown (both Document and Block panels), loose text is
visually placed next to groups of controls, making the controls'
context visually clear, but not programmatically clear.
Additionally, one specific button (the "Public" button which is styled
as a link) has two
<label>
elements attached to it, the secondoverriding the first and giving non-visual users less context.
Issue Code
Remediation Guidance
For most of the selection areas, turning the wrapping element into a
fieldset
and the element with the group name text to alegend
issufficient.
For the "Visibility" and "Publish" sections, the Recommended Code
shows turning the visible text elements near the buttons into headings
(level
h3
) and adding additional context to the publish date buttonas hidden screen reader text.
Another option available is to add
id
attributes to the<span>
and
<button>
elements, then referencing both of them to label thebutton using
aria-labelledby
.Recommended Code
Relevant standards
(Level A)
(Level A)
(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-36 in Tenon's report
The text was updated successfully, but these errors were encountered: