WordPress.org

Make WordPress Core

Opened 6 weeks ago

Closed 8 days ago

#47122 closed defect (bug) (fixed)

Media views: fix unlabelled controls

Reported by: afercia Owned by: afercia
Milestone: 5.3 Priority: normal
Severity: normal Version:
Component: Media Keywords: has-screenshots
Focuses: ui, accessibility, javascript Cc:

Description

In the various media views, there are various form controls that are unlabelled. That is, either they don't have any associated <label> element, aria-label attribute, etc. or they have an empty label.

Properly labelling form controls is essential for a basic level of accessibility, as labels give form controls their accessible name. The name is then used by assistive technologies to inform users "what" the form control is about.

Not to mention visible <label> elements are clickable and help users with motor impairments to set focus on the associated form control.

A few examples:

The "Insert form URL" input field is wrapped in a <label> that doesn't contain any text:

http://cldup.com/XfLXwgb0O6.png

Worth noting the WordPress accessibility coding standards recommend explicitly associated labels (with for/id) attributes instead of implicitly (wrapping) labels.

The "Link To" select and input field miss an associated label: the visible text "Link To" is just text within a <span> element:

http://cldup.com/CnUp1FSvcW.png

Same when "custom url" is selected and the input field becomes editable:

http://cldup.com/r9Rw0lFOjX.png

I'd like to strongly recommend to make a complete audit of the form controls in the media views and address all the occurrences of unlabelled form controls.

Change History (3)

#1 @afercia
2 weeks ago

  • Milestone changed from Awaiting Review to 5.3
  • Owner set to afercia
  • Status changed from new to assigned

#2 @afercia
2 weeks ago

Related: #47141.

#3 @afercia
8 days ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 45499:

Accessibility: Improve accessibility of all the media views form controls.

  • changes the media views form controls to have explicitly associated labels with for/id attributes
  • adds a few missing labels / aria-labels
  • improves a few existing labels / aria-labels
  • improves semantics in a few places, by adding visually hidden headings, fieldset + legend elements, aria-describedby attributes
  • improves the image custom size input fields and their labelling
  • adds role="status" to the "saved" indicator so that status messages are announced to assistive technologies
  • swaps the columns source order in the image details template, to make visual and DOM order match
  • swaps the "Replace" and "Back" buttons source order in the Replace Image view, to make visual and DOM order match
  • gallery settings: move checkbox label to the right: checkboxes are supposed to have labels on the right
  • merge similar strings, unified to "Drop files to upload" (removed "Drop files here", and "Drop files anywhere to upload")
  • makes the "upload-ui" consistent across the media views
  • hides the IE 11 "X" ::-ms-clear button in the Insert from URL field, as it conflicts with the uploading spinner
  • adds comments to all the media templates to clarify their usage
  • slightly increases vertical spacing between form fields in the media sidebar
  • removes some CSS selectors introduced as backwards compatibility for WordPress pre-4.4
  • removes some CSS still targeting Internet Explorer 7 and 8

Fixes #47141.
Fixes #47122.

Note: See TracTickets for help on using tickets.