The facet checkboxes this module adds via JavaScript when the checkbox links widget is being used do not have labels.

Although there is a link right next to the checkbox that should help with accessibility quite a bit, Section 508 guidelines require the checkbox to have an actual label and apparently don't have much room to budge on that.

So, I wrote a patch to do this. The label is invisible (only shown to screen reader users) since it duplicates information already found in the link itself.

A better way to do this might be to have the JavaScript transform the link into a label directly (similar to what is proposed in #1526020-10: When a facet is active, facet text should also be a link (or at least themeable, at best, configurable)). Then there would be no duplication. I didn't do this because by changing the HTML that way it would mess up some theming (in particular on the site I need this for, but also in general given that Facet API has a stable release).

In any case, this patch ought to be a good start regardless of which method is eventually chosen.

#1 facetapi-accessibility-checkbox-labels-1809030-1.patch2.17 KBDavid_Rothstein
PASSED: [[SimpleTest]]: [MySQL] 566 pass(es). View
Members fund testing for the Drupal project. Drupal Association Learn more


David_Rothstein’s picture

Status: Active » Needs review
2.17 KB
PASSED: [[SimpleTest]]: [MySQL] 566 pass(es). View

Here is the patch.

cpliakas’s picture

Status: Needs review » Reviewed & tested by the community

This looks good to me. Verified that the patch in #1809030-1: Facet checkbox links don't have labels adds the ID and label appropriately.

cpliakas’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 7.x versions of Facet API.

6.x-3.x will need a backport. #1816052: Backport: Facet checkbox links don't have labels.

Thanks for the contribution,

FiNeX’s picture

Status: Fixed » Needs work

Hi, I've downloaded the latest -dev version (I've checked the source code, it contains the patch), but the problem is not solved: the label is still hidden after clicking on a checkbox.

The HTML contains the link, but it has "display:none".

cpliakas’s picture

Status: Needs work » Fixed

Hi FiNeX.

Thanks for the post. Re-closing as fixed, because the purpose of this patch is for accessibility and not display. That is why the display:none is in place. If you are looking to modify the display of the facets by prefixing with a label, then that is a separate issue we can talk though in a new support request to help meet your need.


FiNeX’s picture

Sorry @cpliakas, I didn't understood the purpose of the topic, I've confused the "label" term :-) Thanks for the feedback, I will open a separate report.

David_Rothstein’s picture

I think #1526020: When a facet is active, facet text should also be a link (or at least themeable, at best, configurable) (linked to previously) is at least partially related to that as well.

cpliakas’s picture


Not a problem at all! As David_Rothstein mentioned, let's continue the discussions / patches for the topic you brought up in that thread.

Thanks all,

Status: Fixed » Closed (fixed)

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