Skip to content

Related Page cards raise Wagtail accessibility error #660

@rosslaird

Description

@rosslaird

When a user selects to show Related Pages, each card in the resulting card block has the following header:

<h5 class="card-title">

Unless the main content of the page has h4 as the final header tag, this raises an Accessibility error in Wagtail:

Incorrect heading hierarchy
Avoid skipping levels

The CRX cards could be excluded from the accessibility check, using Wagtail's accessibility settings; however, the error would still be there, and the page would not be fully accessible.

Another option would be to change the card header tags (to <span>, for example), and style with CSS. (Using a <p> element would not solve the issue, as it would raise yet another accessibility error: p-as-heading).

Using <span> with role=heading would be one method, though this is not recommended from an accessibility point of view:

The best way to use this role is to not use it at all, and instead use the native heading tags h1 through h6.

So, I'm not sure what would be best here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: EnhancementNew feature or functionality change

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions