Accessiblity - Missing fieldset label in date range

Created on 8 September 2025, 29 days ago

Problem/Motivation

Widget used: `facets_form_date_range`
If the "Show title of facet" checkbox is disabled in the facet configuration form, the fieldset label ("") is not rendered:

return [
  $facet->id() => [
  '#type' => 'fieldset',
  '#tree' => TRUE,
  '#title' => $facet->get('show_title') ? $facet->getName() : NULL,

This causes an accessibility issue:
"Fieldset element does not have a name available to an accessibility API. Valid names are: legend element, aria-label undefined, aria-labelledby undefined."

Steps to reproduce

1. Create a facet with `facets_form_date_range` and disable the "Show title of facet" option in the widget configuration form.
2. Navigate to the page where the facet is displayed and run an accessibility scan.

Proposed resolution

I can see two possible solutions:
1. Add an aria-label attribute to the fieldset.
2. Visually hide the fieldset label instead of setting it to an empty string.

📌 Task
Status

Active

Version

1.0

Component

Code

Created by

🇭🇺Hungary peter_serfozo

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

Comments & Activities

Production build 0.71.5 2024