Forms: required checkbox and radio groups don't link their fieldset to the error message
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- accessibility, frontend
Research direction
Start in projects/packages/forms/src/contact-form/class-contact-form-field.php and compare get_described_by() with the radio and checkbox fieldset markup around the cited lines. Reproduce with the provided required-field form, submit it empty, and inspect whether each fieldset's aria-describedby points to its error message. Done when both groups expose that accessible description; the issue does not name a test file.
Written by the indexing model from the issue text.
Description
Impacted plugin
Jetpack
Quick summary
When a required single input fails validation, it gets aria-describedby pointing at its error message. Required checkbox and radio groups don't: the fieldset gets aria-invalid="true", but nothing references the error message.
After clicking Submit on an empty form:
| Field | aria-invalid |
aria-describedby |
Accessible description in Chromium |
|---|---|---|---|
| Required text input | true |
g4-yourname-text-error-message |
"This field is required." |
Required field-checkbox-multiple fieldset |
true |
none | empty |
| Required radio fieldset | true |
none | empty |
The error messages exist, as g4-picksome-select-error-message and g4-pickone-radio-error-message. The individual checkbox and radio inputs don't reference them either. The visible error therefore isn't programmatically associated with its group (relevant to WCAG 1.3.1).
Single inputs get the link from get_described_by(), but the group fieldset tags don't use it (radio, checkbox). Adding it there looks like the fix, with type radio for radio groups and select for checkbox groups, but I haven't tried that change.
Steps to reproduce
- Add this form to a page, with Jetpack's Forms module active:
<!-- wp:jetpack/contact-form -->
<div class="wp-block-jetpack-contact-form">
<!-- wp:jetpack/field-text {"required":true} -->
<div class="wp-block-jetpack-field-text"><!-- wp:jetpack/label {"label":"Your name","required":true} /-->
<!-- wp:jetpack/input /--></div>
<!-- /wp:jetpack/field-text -->
<!-- wp:jetpack/field-checkbox-multiple {"required":true} -->
<div class="wp-block-jetpack-field-checkbox-multiple"><!-- wp:jetpack/label {"label":"Pick some","required":true} /-->
<!-- wp:jetpack/options -->
<ul class="wp-block-jetpack-options"><!-- wp:jetpack/option {"label":"Red"} /-->
<!-- wp:jetpack/option {"label":"Blue"} /--></ul>
<!-- /wp:jetpack/options --></div>
<!-- /wp:jetpack/field-checkbox-multiple -->
<!-- wp:jetpack/field-radio {"required":true} -->
<div class="wp-block-jetpack-field-radio"><!-- wp:jetpack/label {"label":"Pick one","required":true} /-->
<!-- wp:jetpack/options -->
<ul class="wp-block-jetpack-options"><!-- wp:jetpack/option {"label":"Yes"} /-->
<!-- wp:jetpack/option {"label":"No"} /--></ul>
<!-- /wp:jetpack/options --></div>
<!-- /wp:jetpack/field-radio -->
<!-- wp:jetpack/button {"element":"button","text":"Submit"} /-->
</div>
<!-- /wp:jetpack/contact-form -->
- View the page logged out and click Submit with everything empty.
- Inspect the text input and both
fieldsetelements.
Expected: each fieldset has aria-describedby pointing at its error message, as the text input does.
Actual: each fieldset has aria-invalid="true" and no aria-describedby.
Tested on
- Jetpack 16.3.1 (Forms package 8.3.2) and 16.4 (Forms package 8.3.7), with the same result on both. The
fieldsetcode looks the same on trunk, from reading the source only. - WordPress 7.1.4, PHP 8.3, Twenty Twenty-Five, only Jetpack active, on WordPress Playground in Jetpack offline mode.
- Headless Chromium 156. Both inner-block field markup and attribute-style markup behave the same.
I checked Chromium's accessibility tree, not a real screen reader. I only ran the default form style. No console errors.
Site owner impact
Fewer than 20% of the total website/platform users
Severity
Moderate
What other impact(s) does this issue have?
No revenue impact
If a workaround is available, please outline it here.
Site code can add aria-describedby to the fieldset, pointing at the error message's ID.
Platform (Simple and/or Atomic)
Self-hosted
- Dominant language
- PHP
- Stars
- 1.9k
- Forks
- 906
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 800
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Automattic/jetpack
-
[Package] My Jetpack [Type] Bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Automattic/jetpack#54189 ·
Maintainers usually reply within 1 day
-
[Package] Stats Admin [Type] Bug
Difficulty 1/5 Under an hour Newbie friendliness 86/100
Automattic/jetpack#54188 ·
Maintainers usually reply within 1 day
-
Bug Needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Automattic/jetpack#53467 ·
Maintainers usually reply within 1 day
-
Brute_Force_Protection: two deprecated static wrappers throw Error on PHP 8 (self:: to non-static methods)Possibly taken @Valley-15 claimed this 63 days ago. OpenBug Needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Automattic/jetpack#51728 ·
Maintainers usually reply within 1 day
-
Bug Needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Automattic/jetpack#51662 ·
Maintainers usually reply within 1 day
All issues in Automattic/jetpack
Similar issues
-
sync-en
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
[Sync EN] Formatting improvements to "Large Objects (LOBs)" docs (#6056)Possibly taken A pull request linked to this issue is open or already merged. Opensync-en
Difficulty 1/5 Under an hour Newbie friendliness 74/100
Maintainers usually reply within 1 day
-
Перевод устарел
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 1 day
-
repo:cms
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
craftcms/cms#20613 · 1 comment ·
Maintainers usually reply within 1 day
-
项目日志弹出窗尺寸可拉伸功能Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day