Pager template h4 can be out of document hierarchy order

Created on 9 September 2021, about 3 years ago
Updated 25 January 2023, almost 2 years ago

Problem/Motivation

The system pager template(s) contain a hardcoded h4.visually-hidden element. In some common contexts, this produces a heading in the document which does not follow heading level order. This is reported as a (best practices) accessibility issue by tools such as aXe.

- https://git.drupalcode.org/project/drupal/-/blob/9.2.x/core/modules/syst...

- https://www.w3.org/WAI/tutorials/page-structure/headings/
- https://dequeuniversity.com/rules/axe/4.3/heading-order

This was raised in Drupal Slack #accessibility channel, see there for some early discussion.

aXe's report is a best practices notification, moderate impact:

Heading levels should only increase by one.

Issue description: Ensures the order of headings is semantically correct

To solve this issue, you need to... Fix the following: Heading order invalid

Steps to reproduce

This affects all default themes in 9.2.x: Bartik, Claro, Olivero, Seven, and Stark.

- Use Devel Generate to generate 50 nodes
- View the default /node view
- Observe that the headings in the document run h1 (page title), h2 (node titles), h4 (pagination), OR
- Run aXe Devtools or other a11y checker

Proposed resolution

Remove the h4 and use a aria-label and/or role on the <nav> element

There's already an aria-labelledby on the <nav>; we could replace that with aria-label and remove the <h4> entirely. This requires that the replacement provide equivalent functionality / accessibility. Is a role also appropriate here? There may be many pagination controls on a single page.

Other options considered:

Remaining tasks

User interface changes

Hopefully, increased accessibility. Changes to HTML output.

API changes

Proposed options will change elements in default themes.

Data model changes

Release notes snippet

πŸ› Bug report
Status

Closed: duplicate

Version

10.1 ✨

Component
SystemΒ  β†’

Last updated 3 days ago

No maintainer
Created by

πŸ‡³πŸ‡ΏNew Zealand xurizaemon Ōtepoti, Aotearoa 🏝

Live updates comments and jobs are added and updated live.
  • Accessibility

    It affects the ability of people with disabilities or special needs (such as blindness or color-blindness) to use Drupal.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024