The modules install page has label tags around the module names, making them easy to select/deselect (and, for non-sighted folks, making the form easier to use). The uninstall page does not have said labels. It's a convenience thing for me, but it could be an accessibility thing for others.

Comments

Everett Zufelt’s picture

Title: Module Uninstall Page Missing HTML Form Labels » Administer > Modules pages make improper use of form labels
Version: 6.x-dev » 7.x-dev
Component: markup » base system

I have moved this to base and d7 because the form labels on the Administer > Modules page are improper there and the solution can hopefully be back ported.

In Drupal 7 on the Module List and Uninstall pages both the checkbox and module name are enclosed in a label. Both labels for attribute point to the id of the checkbox input element. This does not work with many screen-readers as they are expecting only one label per form field and default to using the first label, which has no associated text or title to be communicated to the user.

The current code:

Modules List

<label class="option" for="edit-modules-Core-aggregator-enable"><input type="checkbox" name="modules[Core][aggregator][enable]" id="edit-modules-Core-aggregator-enable"
value="1"   class="form-checkbox" /> </label>

<label for="edit-modules-Core-aggregator-enable"><strong>Aggregator</strong></label>

Modules Uninstall

 <label class="option" for="edit-uninstall-aggregator"><input type="checkbox" name="uninstall[aggregator]" id="edit-uninstall-aggregator" value="aggregator"
  class="form-checkbox" /> </label>

<strong><label for="edit-uninstall-aggregator">Aggregator</label></strong>

Recommended changes

To clarify either of the following options would allow for a screen-reader to find appropriate information to communicate to the user. I have used the above two code segments and shown the two markup options, one for each.

Wrapping only the module name in a label

<input type="checkbox" name="modules[Core][aggregator][enable]" id="edit-modules-Core-aggregator-enable"
value="1"   class="form-checkbox" /> 

<label for="edit-modules-Core-aggregator-enable"><strong>Aggregator</strong></label>

The only modification in the above example is to remove the label that encloses the checkbox, this may not be possible without a change to fapi

Using the title attribute

 <label class="option" for="edit-uninstall-aggregator"><input type="checkbox" title="Aggregator" name="uninstall[aggregator]" id="edit-uninstall-aggregator" value="aggregator"
  class="form-checkbox" /> </label>
<strong>Aggregator</strong>

There are two modifications in the above example. The first is to add title="Aggregator" to the checkbox input field, the second is to remove the label that encloses the module name.

Everett Zufelt’s picture

StatusFileSize
new1.89 KB

This patch is localized to modules/system/system.admin.inc: system_modules_build_row() and should resolve all problems related to this issue that are not covered by the blocker issue #522772: Improve radio and checkbox title and labeling features for accessibility.

1. Removes label elements that wrap the module name on administer > build > modules : list and uninstall

2. Sets the #title property of the checkbox elements to the module name. This will not appear in the page source when rendered because of the blocker issue.

Everett Zufelt’s picture

Status: Active » Needs review
Everett Zufelt’s picture

StatusFileSize
new985 bytes

This new patch leaves label wrapped around the module name, but removes all setting of the #title property for the checkbox element. This means that theme_checkbox will not produce a label for the checkbox and the properly associated label wrapped around the module name will be recognized by assistive technology.

Everett Zufelt’s picture

Status: Needs review » Postponed

Working on a new approach. Leaving this issue until #522772: Improve radio and checkbox title and labeling features for accessibility is fixed.

Everett Zufelt’s picture

Status: Postponed » Needs review
StatusFileSize
new2.13 KB

Determined the best current solution that is not blocked by #522772: Improve radio and checkbox title and labeling features for accessibility.

Issue:
On admin > build > modules (list and uninstall tabs) both the checkbox input element and module name are wrapped in label elements with for attribute set to the id of the checkbox element. This confuses screen-readers and no information is communicated to the screen-reader user.

Solution:

1. includes/form.inc: Modified theme_radio and theme_checkbox to only output label element if $element['#title'] is not empty, was set to if not null. This was outputting labels even when the title attribute was an empty string value.

2. modules/system/system.admin.inc: _system_modules_build_row: Removed line of code that sets #title property for checkbox to 'Enabled', as this is unset in theme_system_modules_fieldset

3. modules/system/system.admin.inc: theme_system_modules_fieldset: removed line of code that unsets $element['#title'] as it is no longer being set (see 2 above).

Summary:
As the #title is no longer being set for the checkbox, and since theme_checkbox (and theme_radio) will now only output labels on non-empty #title attributes, only the module name receives a label wrapper.

Everett Zufelt’s picture

Component: base system » system.module

Changing the component as administer > build > modules is part of system.module

Status: Needs review » Needs work

The last submitted patch failed testing.

mgifford’s picture

Status: Needs work » Needs review
StatusFileSize
new2.14 KB

Would like to have this issue resolved. Here's a rerolled patch.

Status: Needs review » Needs work

The last submitted patch failed testing.

cliff’s picture

Fixed by latest patch for #558928: Form element labeling is inconsistent, inflexible and bad for accessibility (see comment #68), which has not yet been set to RTBC. Can anyone review that patch and either vouch that it is RTBC or fix any minor deficiencies to get it there?

Fixing these issues will make D7 a viable option for many governments and governmental agencies throughout North America, the United Kingdom, and the rest of Europe — anywhere that accessibility is required of them by law. This patch is a major step towards ensuring that Drupal can produce accessible Web sites.

mgifford’s picture

Status: Needs work » Needs review

I'm setting this back to needs review as my local install of this patch didn't produce any errors in simpletest.

mgifford’s picture

cliff’s picture

I would think so. Other votes?

Everett Zufelt’s picture

Status: Needs review » Postponed
traviscarden’s picture

Issue tags: +#d7ux

Tagging #d7ux

bowersox’s picture

subscribing

mgifford’s picture

Status: Postponed » Fixed

Status: Fixed » Closed (fixed)
Issue tags: -#d7ux

Automatically closed -- issue fixed for 2 weeks with no activity.