Conversation
Field now generates an id for its label and lets the first nested control claim it, so screens like login get a proper for/id association without call-site changes. Explicit Field ids (Publish) are not injected, avoiding duplicate ids inside fieldtypes.
Wire ErrorMessage and Description ids into aria-describedby, set aria-invalid on the field's control, and focus the first invalid control after a failed submit so screen readers can find the error.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the Problem
When a publish form (or login) fails validation, the error is shown visually but never connected to the control that failed. Measured after a failed save on an empty required field:
aria-invalid="true"aria-describedbyon the inputBODYOn a long blueprint that means walking the entire form to find the error. Field instructions have the same gap — they’re rendered as unlinked siblings. WCAG 2.1 SC 3.3.1 (and related 3.3.2).
Depends on fields having reliable ids (#15389).
What this PR Does
ErrorMessage/Descriptionstable ids ({fieldId}-error,{fieldId}-description)aria-describedbyandaria-invalidon the field’s own control (id must match the Field id, so Table/List cells aren’t all marked invalid)aria-describedbywith the field’s description/error idsreveal.invalid(), including login)Fixes #15396
Related: #15389
How to Reproduce
After this PR: the failing input is focused, has
aria-invalid="true", andaria-describedbypointing at the error (and instructions when present).