The Drupal 7 pager has very poor accessibility support. One word links in the pager read by a screen reader (E.g. "one" "two" "three" "next" "last") lose all meaning and are impossible to interpret when taken out of context (WCAG 2.0, section 2.4.9)
This is largely fixed now in Drupal 8, so I've written a backport of pager.twig.html from Drupal 8 to pager.tpl.php for Drupal 7 for a client university project that wants to improve the #a11y support on their library Drupal 7 website.
The gist here is meant for someone to be able to paste this into their theme:
- Code (Gist): https://gist.github.com/jameswilson/678e7f9fcc50cc92fbeb
- g.d.o Accessibility discussion thread: https://groups.drupal.org/node/477038
I've written the DOM changes in a way that leverages existing Drupal 7 classnames and styles, without causing any visual changes, and I think Drupal core could benefit from this contribution.
But before I start working on a patch for D7 core, is Drupal 7 accepting such backport issues for accessibility improvements?
Comments
Comment #2
jwilson3I've checked the backport policy but found no mention of accessibility.
The only thing listed there that is cause for concern on this issue is:
The gist as posted above does slightly change the DOM structure for the current page item in the pager list. In D8, the current page is wrapped in an anchor link tag (i've currently written the backport to do this also), but in current core D7, the current page has no link tag.
The rest of the HTML changes I don't think would break themes, as we're only adding spans and hidden divs containing accessible text hidden on the screen.
So, I'lI need to rework how the current page
<li>element is created when converting this to a patch.Comment #3
jwilson3