Accessibility: skipped heading level on for search "no results" text

Created on 13 November 2020, about 4 years ago
Updated 21 June 2024, 5 months ago

Problem/Motivation

When there are no search results, the markup of the "empty" message is h3, but there's no h2. Best practice is to not skip heading levels (WCAG success criteria 1.3.1, "Organizing a page using headings" advisory technique).

EDIT: More importantly, as pointed out in the thread, this heading doesn't head any content -- the heading is used to make the text look a certain way:

https://www.w3.org/WAI/WCAG21/Techniques/failures/F43 - either "Example 1: A heading used only for visual effect" OR "Example 2: Using heading elements for presentational effect"

Steps to reproduce

On a Drupal site with default/core search, run a search that yields no results, i.e. "asdfgghjhasdfj"--
/search/node?keys=asdfgghjhasdfj

On the resulting page, you'll see the following markup:
<h3>Your search yielded no results.</h3>

Proposed resolution

Replace the heading markup with a simple <p> or <div> element -- perhaps with a class if styling is desired, but that would be optional.

Remaining tasks

  1. Update "empty" markup (SearchController.php line 121). - DONE
  2. Backport to Stable 9 theme. - DONE

User interface changes

The heading markup.

Before:

After using paragraph tag (not implemented solution):

After using emphasis tag but adding Olivero styling to match the previous style (current implemented solution):

API changes

n/a

Data model changes

n/a

Release notes snippet

(?)

๐Ÿ› Bug report
Status

Fixed

Version

11.0 ๐Ÿ”ฅ

Component
Searchย  โ†’

Last updated 8 days ago

  • Maintained by
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States @pwolanin
Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States alison

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

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