WordPress.org

Make WordPress Core

Opened 12 months ago

Last modified 3 months ago

#24148 new enhancement

Add aria-labelledby attributes to comment form

Reported by: joedolson Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.5
Component: Comments Keywords: has-patch
Focuses: accessibility Cc:

Description

The aria-labelledby attribute provides a means for screen readers to get additional context for inputs when there is additional labeling information provided. In the default comment form, information such as the fact that email will not be published or that HTML tags and attributes can be used can only be viewed through a separate pass through the form not in forms mode. Adding these attributes means that a screen reader will read both blocks of text as the label for the field.

Attachments (1)

comment-template.php.patch (4.0 KB) - added by joedolson 12 months ago.
Updated patch for aria-labelledby

Download all attachments as: .zip

Change History (7)

comment:1 SergeyBiryukov12 months ago

  • Type changed from defect (bug) to enhancement
  • Version changed from trunk to 3.5

comment:2 obenland12 months ago

Do we really need additional html elements for the ids? Can't the labels or the p elements carry them with the same effect?

joedolson12 months ago

Updated patch for aria-labelledby

comment:3 joedolson12 months ago

That occurred to me as well pretty well immediately after posting the patch. We can use the label to carry the ID for the comment form, eliminating that extra HTML element, but need to keep the span element for the email address notice. Adding the id to the paragraph element there would mean that the required text string would be included in the label as well, which would be redundant as it is already announced as required because of the aria-required attribute. New patch attached.

comment:4 bramd6 months ago

Shouldn't we use aria-describedby here to associate the email notice? THen it will usually be spoken after the contents of the field by screenreaders.

comment:5 joedolson6 months ago

The same is true of aria-labelled by; mostly it's a question of whether the additional text is an extended description of the field or an extension of the label. But either will work and be perfectly acceptable, functionally.

comment:6 nacin3 months ago

  • Component changed from Accessibility to Comments
  • Focuses accessibility added
Note: See TracTickets for help on using tickets.