[wp-trac] [WordPress Trac] #37649: Bind `label`s to form controls in Tools > Export screen
WordPress Trac
noreply at wordpress.org
Mon Aug 29 23:14:13 UTC 2016
#37649: Bind `label`s to form controls in Tools > Export screen
--------------------------+-----------------------------
Reporter: mercime | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: Export | Version:
Severity: normal | Resolution:
Keywords: has-patch | Focuses: accessibility
--------------------------+-----------------------------
Comment (by mercime):
> Because this field is labeled implicitly, adding the for and id
attributes doesn't accomplish anything
Hi @joedolson. Please note that this patch also includes adding a
`<label>` tag to a `<select>` form control which is required.
As to implicit labelling, when I started improving a11y for projects and
sites, one of my go-to references is the [https://developer.mozilla.org
/en-
US/docs/Web/Guide/HTML/Forms/How_to_structure_an_HTML_form#The_<label>_element
Mozilla Developer Network] site where it states:
A `<label>` element is bound to its widget with the for attribute. The
for attribute references the id attribute of the corresponding widget. A
widget can be nested inside its `<label>` element but even in that case,
it is considered best practice to set the for attribute because some
assistive technologies do not understand implicit relationships between
labels and widgets.
In addition, the [https://make.wordpress.org/core/handbook/best-practices
/coding-standards/accessibility-coding-standards/ WordPress A11y Coding
Standards] the information given there is that "All form inputs must
include an '''explicitly associated''' `<label>` element."
So if the WP a11y team consensus is that adding `for` attributes for
`<label>`s is useless when widgets are nested, perhaps that should be
clarified, as I see at least many instances throughout the WP codebase
where `for` attributes were added to `<label>`s with widgets nested. Thank
you.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/37649#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list