Skip to content

[Topic] Adds form documentation about input/label#202

Merged
rianrietveld merged 18 commits intomainfrom
115-label-input
Oct 23, 2025
Merged

[Topic] Adds form documentation about input/label#202
rianrietveld merged 18 commits intomainfrom
115-label-input

Conversation

@rianrietveld
Copy link
Copy Markdown
Member

@rianrietveld rianrietveld commented Oct 11, 2025

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

  • Input field and form label (intro).
  • Give a form field an accessible name with a label.
  • Placeholders in form fields.
  • Only include text in the label.
  • Place the label above the form field (best practice)

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/

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Oct 11, 2025

PR Preview
Preview removed because the pull request was closed.
2025-10-23 05:53 UTC

@rianrietveld rianrietveld moved this to PRs to review in WP A11y docs Oct 11, 2025
@rianrietveld rianrietveld linked an issue Oct 11, 2025 that may be closed by this pull request
@rianrietveld rianrietveld requested review from a team, AnneliesDT, GaryJones, aialvi and joedolson and removed request for a team and aialvi October 11, 2025 07:14
@rianrietveld rianrietveld self-assigned this Oct 11, 2025
@rianrietveld rianrietveld linked an issue Oct 11, 2025 that may be closed by this pull request
Comment thread docs/topics/code/accessible-name/index.md Outdated
Comment thread docs/topics/code/accessible-name/index.md Outdated
Comment thread docs/topics/code/accessible-name/index.md Outdated
Comment thread docs/topics/code/accessible-name/index.md Outdated
Comment thread docs/topics/code/accessible-name/index.md Outdated
Comment thread docs/topics/forms/input-label/placeholders.md Outdated
Comment thread docs/topics/forms/input-label/text-only.md Outdated
Comment thread docs/topics/forms/input-label/text-only.md Outdated
Comment thread docs/topics/forms/input-label/text-only.md
Comment thread docs/topics/forms/resources.md Outdated
@rianrietveld
Copy link
Copy Markdown
Member Author

@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.

@rianrietveld rianrietveld linked an issue Oct 13, 2025 that may be closed by this pull request
GaryJones
GaryJones previously approved these changes Oct 14, 2025
aialvi
aialvi previously approved these changes Oct 14, 2025
@rianrietveld rianrietveld dismissed stale reviews from aialvi and GaryJones via 45276b2 October 15, 2025 06:37
Copy link
Copy Markdown
Contributor

@AnneliesDT AnneliesDT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copy link
Copy Markdown
Member Author

@rianrietveld rianrietveld Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Member Author

@rianrietveld rianrietveld Oct 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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."

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add more pages here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Related pages are missing here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See previous comments

@rianrietveld rianrietveld linked an issue Oct 16, 2025 that may be closed by this pull request
@rianrietveld rianrietveld requested review from AnneliesDT and removed request for AnneliesDT, GaryJones and joedolson October 20, 2025 10:27
@rianrietveld rianrietveld merged commit be7a368 into main Oct 23, 2025
1 check passed
@rianrietveld rianrietveld deleted the 115-label-input branch October 23, 2025 05:53
@github-project-automation github-project-automation Bot moved this from PRs to review to Done in WP A11y docs Oct 23, 2025
@rianrietveld rianrietveld mentioned this pull request Oct 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Topic] Accessible name [Topic] Placeholders [Topic] Input fields and form labels

4 participants