-
Notifications
You must be signed in to change notification settings - Fork 386
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
Add note on visually hidden labels #863
base: main
Are you sure you want to change the base?
Conversation
@primer/accessibility-design - Would love a review on this PR, as I believe we can add this note to other form elements that describe usage of "visually hidden" labels. |
@@ -49,7 +49,9 @@ For more information about the "valid" and "invalid" states, see the [validation | |||
src="https://user-images.githubusercontent.com/6905903/274239156-064abae9-6d16-4c1a-b673-ec8f96429ed9.png" | |||
/> | |||
|
|||
**Label (required):** The input's title. It should be as concise as possible and convey the purpose of the input. The label may be visually hidden in rare cases, but a label must be defined for assistive technologies such as a screen reader. | |||
**Label (required):** The input's title. It should be as concise as possible and convey the purpose of the input. The label may be visually hidden in rare cases, but a label must be defined for assistive technologies such as a screen reader. If the label is visually hidden, ensure there is an element nearby that serves as a visual label for the input. This guarantees that all users, including those not using assistive technologies, have access to a label. |
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.
What is an example of a rare case? I worry that without defining that everyone will think their use case is the exception to the rule.
I agree with @ericwbailey, more examples would be beneficial. The most common example is a single field search form, with a magnifying glass icon as the content of the submit button. In this situation, the icon is acting as both the content of the button and the label for the input field. If an icon is used, it must be unambiguous as to its purpose. From a users point of view, they should be able to say the name of the icon and have voice control software associate the name with the control. To continue the above example, the magnifying glass indicates "search". There are very few other icons that have this same association as they relate to input fields, a few more that could apply to button elements (such as "+" for "add", "plus", or "increase"), so it should be exceedingly rare for an icon to be the only label, whether it is part of the If another piece of text is used, the accessible name for the |
Here are a few examples I could think of right now:
We use this prop a lot, so if we want to stop suggesting it entirely we could definitely do so. Thanks too for the input 🙇 |
Adds a note on visually hidden labels, that there must be a visual label defined if the label is visually hidden.
Context: https://github.com/github/primer/issues/3441