The patch in #1918994: Improve Datetime and Daterange Widget accessibility introduces two changes.
One, is that in the datetime-wrapper.html.twig templates for Classy and the default system module, the #description
form element will now have an HTML id
on it that will allow it to be associated via ARIA to an HTML form element. In the global template_preprocess_datetime_wrapper()
function, the $variables['description_attributes']
key exists to add attributes to the wrapper around the #description
. No structural changes are made to datetime-wrapper.html.twig in Classy, other than adding the id to the description. The default system datetime-wrapper.html.twig adds this wrapping div. The Stable datetime-wrapper.html.twig has no changes.
The other change is that in the Datetime and Daterange widgets, compound form elements are now wrapped in a fieldset
, and a singular form element is rendered without a wrapper. This allows proper ARIA descriptions to be applied, and also fixes a misapplication of nested datetime-wrapper.html.twig templates.