[Topic] Adds form documentation about input/label#202
Conversation
|
Co-authored-by: Gary Jones <[email protected]>
Co-authored-by: Gary Jones <[email protected]>
Co-authored-by: Gary Jones <[email protected]>
Co-authored-by: Gary Jones <[email protected]>
Co-authored-by: Gary Jones <[email protected]>
Co-authored-by: Gary Jones <[email protected]>
Co-authored-by: Gary Jones <[email protected]>
Co-authored-by: Gary Jones <[email protected]>
Co-authored-by: Gary Jones <[email protected]>
Co-authored-by: Gary Jones <[email protected]>
|
@GaryJones Thanks for the review, I committed your suggestions. I hope I got them all. A new feature I discovered while doing so is that GitHub offers the option to bundle the suggested commits. That's really nice, because then GH Actions doesn't create a new build with every single commit. |
Thanks Rosanne van Staalduinen
AnneliesDT
left a comment
There was a problem hiding this comment.
In general: am I missing information about instructions in labels? Do we need to explain how to solve the issue with postcodes, phone numbers, mail addresses etc? Or is that a different topic altogether? Because in the related WCAG criteria there's mention of 3.3.2, but I read a lot about labels, but nothing on instructions.
|
|
||
| ## Related pages in this documentation | ||
|
|
||
| - [Accessible name]({{site.baseurl}}/docs/topics/code/accessible-name/). |
There was a problem hiding this comment.
I am on the page Accessible Name, and i get related page: Accessible Name. I think it would be logical to add the other pages underneath Input and label here, because now I would want to read on about Placeholders (next page in the tree).
There was a problem hiding this comment.
@AnneliesDT
About "am I missing information about instructions in labels"?
I'm following (sort of) the docs as I write for the NLDS
When the basics is published I want to add extra pages like: When which form element". In Dutch: https://nldesignsystem.nl/richtlijnen/formulieren/wanneer-welk-form-element/iedereen-kan-invullen/
When that is written I will link to that new content.
My plan is to translate all pages below Forms (Formulieren) and adjust the for WordPress needs.
Only when the content is there I can cross link and refer.
Step by step, first the basics and then the extra's.
There was a problem hiding this comment.
@AnneliesDT About "pages underneath Input and label here".
I was thinking the same, I want to investigate if that functionality already was there in the software, I will create an issue for that.
|
|
||
| # Placeholders in form fields | ||
|
|
||
| For all users to understand how to fill out a form, the **labels** should be connected to form control. |
There was a problem hiding this comment.
For less technical people, what does form control mean? This is quite a vague sentence. We were about to read about placeholders, and now you're talking about labels again. So what is the relation here?
There was a problem hiding this comment.
@AnneliesDT I decided labels and placeholders belong to each other because placeholders are often misused as a label.
About the form control, some form elements are checkboxes or radio buttons and not really fields.
As a word that catches them all. If you know a better word, please let me know.
|
|
||
| For all users to understand how to fill out a form, the **labels** should be connected to form control. | ||
|
|
||
| The **placeholder** represents a short hint (a word or short phrase) intended to aid the user on _what_ to fill out a form field. A hint could be a sample value or a brief description of the expected format. |
There was a problem hiding this comment.
Can we add a visual here? This sentence is quite difficult to read if you don't know already what it is. Or say: "A placeholder usually is a brief description of what needs to be in the form field, put into the field itself. It disappears when the user starts typing in the form field."
There was a problem hiding this comment.
I changed the text and added the disappearing value with the disadvantages.
|
|
||
| Only using a placeholder (without a connected label) has some disadvantages: | ||
| - the form field doesn't have a proper accessible name. | ||
| - the placeholder text may become unreadable when a user zooms in and the text becomes too large for the input field. |
There was a problem hiding this comment.
Not only that: it disappears when the user starts typing, and when it contained important information about the format, the user cannot take another look at it. Especially important for people with memory/focus issues. It's why you need to put important input information in the label or in a description right above the form field.
| - the form field doesn't have a proper accessible name. | ||
| - the placeholder text may become unreadable when a user zooms in and the text becomes too large for the input field. | ||
|
|
||
| For a longer hint or other advisory text, place the text next to the form field. In this case, use [aria-describedby]({{site.baseurl}}/docs/topics/forms/descriptions/) to connect the descriptive text to the field. |
There was a problem hiding this comment.
Not next to, close to, preferable above. "next to" is also a WCAG violation if you're not on desktop and this is the only hint of location)
There was a problem hiding this comment.
I changed 'next' into close, as the 'order' will be addressed with in description section.
|
|
||
| Additional HTML elements can cause problems when screen readers announce the label or when a user tries to focus the input field by voice recognition. | ||
|
|
||
| - The text inside the addition interactive elements will be added to the [accessible name]({{site.baseurl}}/docs/topics/code/accessible-name/). If that text is, for example, a tooltip, the accessible name of the form input can become unreadable, incomprehensible, or just plain wrong. |
There was a problem hiding this comment.
i think this should be "additional"
| - If there is a clickable item inside the label, clicking it can result in also selecting the form control if it's a checkbox. | ||
| - The reading order (meaningful sequence) of the content can get illogical. | ||
|
|
||
| Keep the label with a form control to the point. Include additional information above the form, either as links above the label or form field (whichever makes sense in terms of reading order) or as a description next to the field. |
There was a problem hiding this comment.
extra space after the dot before Include
|
|
||
| Keep the label with a form control to the point. Include additional information above the form, either as links above the label or form field (whichever makes sense in terms of reading order) or as a description next to the field. | ||
|
|
||
| There is an exception when using an implicitly associated form control. But adding an input field inside a label has accessibility concerns. Read [MDN about label accessibility](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/label#accessibility). |
There was a problem hiding this comment.
My noob brain is confused here again. What does this mean? What is an implicitly associated form control? Next sentence also misses context. In my opinion, skip this, or explain a bit more about exceptions and expand a little. We were explaining how to do it, not confuse them with a vague exception.
There was a problem hiding this comment.
This is important, because Contact Forms 7 uses implicitly associated form controls as default.
I will add an example.
|
|
||
| ## Related pages in this documentation | ||
|
|
||
| - [Accessible name]({{site.baseurl}}/docs/topics/code/accessible-name/). |
There was a problem hiding this comment.
Which ones would you like to add here?
Note: I only can add pages that are already published. More links to come when more info is published.
| ## Be consistent | ||
|
|
||
| As this is best practice you are not required to place the label above the form field. But whatever you decide, be consistent. That way the users understand better and faster how to fill out the form. | ||
|
|
There was a problem hiding this comment.
Related pages are missing here.
There was a problem hiding this comment.
See previous comments
Related issues: #155, #200
Preview: https://wpaccessibility.org/pr-preview/pr-202/docs/topics/forms/input-label/
The page input-label is now a section with 5 subpages
I also created an additial page "Accessible name" in the frontend code section to refer to.
Preview: https://wpaccessibility.org/pr-preview/pr-202/docs/topics/code/accessible-name/