Problem/Motivation

Just checked this module for WCAG compliance and saw that the block and search page input don't yet add <search>
https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/search around the form or add role="search" attribute to the form

See https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Referenc...

Prefer HTML

Using the element will automatically communicate that the element has a role of search. If possible, prefer using the semantic element instead of the search role.

If your of type search is already contained within a
, then wrapping the form in another element may be unnecessary markup. In this case, using role="search" on the
itself is acceptable.

So maybe that's the best solution in this case, as we already use '#type' => 'search' for the input.

As WCAG becomes more and more important and is a legal requirement for many companies and the public sector in the EU, I think this is very relevant.

Steps to reproduce

Test WCAG for Search API Pages page / blocks

Proposed resolution

Add the role and aria-label attribute on the search form:
<form role="search" aria-label="Sitewide">

Eventually make the aria-label configurable in the settings with "Sidewide" as default?

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

anybody created an issue. See original summary.

anybody’s picture

Status: Active » Needs review

Please review. I think we should not hard-code the label but make it a configurable label setting, if maintainers agree. Or for now we could just remove it and only add the type.

I'd vote for the first option.

anybody’s picture

Title: WCAG: Wrap search form (block / page) in <search> or add role="search" » WCAG: Wrap search form (block / page) in <search> or add role="search" and aria-label
anybody’s picture

Issue summary: View changes

As WCAG becomes more and more important and is a legal requirement for many companies and the public sector in the EU, I think this is very relevant.