Opened 15 years ago
Closed 13 years ago
#16527 closed enhancement (duplicate)
Accessibility Improvement to category-template.php
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 3.0 |
| Component: | Accessibility | Keywords: | |
| Focuses: | Cc: |
Description
When I was testing my site (http://travisthoughts.com, running WordPress 3.1 RC4) for accessibility at http://wave.webaim.org/, I noticed that the categories widget was not displaying a <label> tag. So upon investigation, I discovered that category-template.php wasn't issuing a <label> tag on line 334 in the function wp_dropdown_categories(). So I propose the following edit.
$output = "<label for='$id' style='display:none;'>$name</label><select name='$name' id='$id' class='$class' $tab_index_attribute>\n"; //added <label for='$id' style='display:none;'>$name</label>
Once I made this change, my site passed web accessibility.
Attachments (1)
Change History (10)
#6
@
14 years ago
The use of display:none style declaration would effectively hide that label from everyone, including users of assistive technologies. Such a declaration should only be used in cases where you absolutely want to hide something from every single visitor.
To provide "hidden" content for users of assistive technologies, position the content offscreen.
#7
@
14 years ago
To provide "hidden" content for users of assistive technologies, position the content offscreen.
For the record, that's what Nacin was referring to above. The class 'screen-reader-text' positions the element off screen so that it's still readable by screen readers.
/* Hide visually but not from screen readers */
.screen-reader-text,
.screen-reader-text span {
position: absolute;
left: -1000em;
height: 1px;
width: 1px;
overflow: hidden;
}
We would use something like screen-reader-text, probably.