Views exposed forms should use SEARCH html element or aria role = search

Created on 16 June 2025, 4 months ago

Problem/Motivation

The SEARCH html element or search aria role is:

> used to identify the search functionality; the section of the page used to search the page, site, or collection of sites.

See:

- https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/search
- https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Referenc...

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component

views.module

Created by

πŸ‡¬πŸ‡§United Kingdom joachim

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

Merge Requests

Comments & Activities

  • Issue created by @joachim
  • First commit to issue fork.
  • Pipeline finished with Canceled
    4 months ago
    Total: 300s
    #525292
  • πŸ‡ΊπŸ‡¦Ukraine vitaliyb98

    Added the search [ARIA] role to the search form provided by the core Search module to improve accessibility and semantic markup:
    core/modules/search/src/Form/SearchBlockForm.php
    and
    core/modules/search/src/Form/SearchPageForm.php

  • Pipeline finished with Success
    4 months ago
    Total: 1059s
    #525299
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    For good practice issue summary should be complete. May need accessibility sign off

  • πŸ‡¬πŸ‡§United Kingdom joachim

    > Added the search [ARIA] role to the search form provided by the core Search module to improve accessibility and semantic markup:

    That looks useful too, but the issue was about Views.

    Also, an a11y problem is a bug.

  • πŸ‡ΊπŸ‡¦Ukraine vitaliyb98

    Hi @joachim, could you please provide more details?
    Do you mean adding this attribute to every Exposed Form, even if it doesn't contain a text input for example, if it only has checkboxes?

  • πŸ‡¨πŸ‡¦Canada mgifford Ottawa, Ontario

    I made some small changes to the issue summary.

    The latest MR adds the ARIA search role to the existing form.

    It would be better though to switch core/modules/search/src/Form/SearchBlockForm.php & core/modules/search/src/Form/SearchPageForm.php to just use <search> though. HTML (including search) is always better, if possible, than using ARIA.

  • Status changed to Needs work about 1 month ago
  • πŸ‡ΊπŸ‡¦Ukraine vitaliyb98

    I tried to wrap the search form with the HTML element using a template override.
    But adding extra markup around the form broke the styles and JavaScript for the search block (tested in the Olivero theme).

    For now, it seems we can only safely add this wrapper directly in the Olivero theme, together with fixes for the broken search functionality. If we add the wrapper globally (for example, in the Search module), it could break other themes as well.

Production build 0.71.5 2024