Accessibility: Search form block duplicates edit-submit id attribute

Created on 26 August 2023, over 1 year ago
Updated 27 September 2023, about 1 year ago

Problem/Motivation

Having a search block on every page is a very common use-case. However Drupal assigns an edit-submit id attribute to the button, and an edit-keys id attribute to the search input. That means we have a possibility to have a collision of duplicate ids on every page where we add a form apart from the search block form. That happens when this cached search block is rendered in a new context, because the search form is not processed to avoid id collisions, resulting in both forms having the edit-submit id attribute.

Providing unique IDs for this one form would substantially improve accessibility for most sites.

Steps to reproduce

- Enable caching
- Assign core search block to all pages
- As anonymous, visit a page without any forms other than search block
- Now, visit a page with search block and additional forms, e.g. login page

Proposed resolution

Just changing the IDs on the search form would fix this specific and common problem.
- Set a different id attribute on the submit button (other than edit-submit)
- Set a different id attribute on the input (other than edit-keys)

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
SearchΒ  β†’

Last updated 9 days ago

  • Maintained by
  • πŸ‡ΊπŸ‡ΈUnited States @pwolanin
Created by

πŸ‡ͺπŸ‡ΈSpain juanolalla

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024