Problem/Motivation

  • theme_facetapi_link_inactive() and theme_facetapi_link_active() do similar things but parts of the code are in different order or achieve the same things in different ways.
  • It's hard to see how theme_facetapi_link_inactive() and theme_facetapi_link_active() construct their markup.
  • There is a theme_facetapi_deactivate_widget() but not a theme_facetapi_activate_widget()
  • The deactivate widget is visible to screenreaders.
  • The deactivate widget is not wrapped in a span so it can be themed / distinguished from the other parts of the facet link.
  • The facet count widget is not wrapped in a span so it can be themed / distinguished from the other parts of the facet link.
  • There is a string t('!facetapi_deactivate_widget !facetapi_accessible_markup') for active links (presumably so it can be re-ordered) but no corresponding one for inactive links.

Proposed resolution

Clean up all these functions. Add a theme_facetapi_activate_widget(). Wrap the widgets in spans so they can be themed.

Remaining tasks

  1. Write the patch
  2. Review and RTBC
  3. Commit

User interface changes

None.

API changes

  • API Addition: add activate widgets
  • API Addition: spans to make theming easier
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mparker17’s picture

Issue summary: View changes
mparker17’s picture

Issue summary: View changes
mparker17’s picture

Assigned: mparker17 » Unassigned
Status: Active » Needs review
FileSize
5.96 KB

I've attached a patch. Feedback welcome.

mparker17’s picture

FileSize
5.96 KB
409 bytes

Noticed an incorrect function docblock.

cpliakas’s picture

Status: Needs review » Needs work

Hi mparker17.

Thanks for the contribution! I am all for improving accessibility as long as we are able to maintain some form of backwards compatibility.

Marking as needs work because it appears that patch no longer applies to HEAD.

Thanks!
Chris

mparker17’s picture

Status: Needs work » Needs review
FileSize
5.99 KB

Sorry for the delay in getting the re-rolled patch to you: it took me a little longer to verify that the re-rolled patch had the same result... apparently the merge conflict was due to #2166095: Inline documentation typo in facetapi.theme.inc, but that one-line-change threw off the diff algorithm and caused it to rearrange the whole patchfile. :P

Straight re-roll, so no interdiff.

This change shouldn't break backwards compatibility:

  • theme_facetapi_link_inactive() and theme_facetapi_link_active() used to generate nearly-identical HTML in different ways. This patch fixes it so they generate the same HTML they did before, but in the same way. — EDIT: this is wrong.
  • theme_facetapi_deactivate_widget() now puts an span around the (-) in active links so it can be themed. The active links will look the same, and the span won't show up unless you add CSS to make it do so.
  • I've added atheme_facetapi_activate_widget() puts an empty span in inactive links (in the same place that the deactivate widget goes in active links) so it can be themed. The inactive links will look the same, and the span won't show up unless you add CSS to make it do so.
mparker17’s picture

FileSize
6.01 KB
747 bytes

Adding a class to the activate and deactivate links so it's easier to write CSS for them.

mparker17’s picture

theme_facetapi_link_inactive() and theme_facetapi_link_active() used to generate nearly-identical HTML in different ways. This patch fixes it so they generate the same HTML they did before, but in the same way.

I was wrong. Active links now look like inactive links, i.e.: the format is <a>{term} {accessible_markup} ({count}) {widget}</a> where the widget is an empty span with it's own theming function so it can be modified further down the theming layer.

mgifford’s picture

Issue tags: -a11y +Accessibility