Commit 14baa0b3 authored by catch's avatar catch

Issue #2126761 by Tim Bozeman, SGhosh, Jalandhar: The body field summary...

Issue #2126761 by Tim Bozeman, SGhosh, Jalandhar: The body field summary textarea indicates it has a description with aria-describedby attribute, but the DOM id value points to a non-existent node.
parent 7a8d0cd2
......@@ -63,7 +63,11 @@ function filter_theme() {
'template' => 'filter-tips',
),
'text_format_wrapper' => array(
'variables' => array('children' => NULL, 'description' => NULL),
'variables' => array(
'children' => NULL,
'description' => NULL,
'attributes' => array(),
),
'template' => 'text-format-wrapper',
),
'filter_guidelines' => array(
......@@ -664,6 +668,25 @@ function template_preprocess_filter_guidelines(&$variables) {
);
}
/**
* Prepares variables for text format wrapper templates.
*
* Default template: text-format-wrapper.html.twig.
*
* @param array $variables
* An associative array containing:
* - attributes: An associative array containing properties of the element.
*/
function template_preprocess_text_format_wrapper(&$variables) {
// Add element class and id for screen readers.
if (isset($variables['attributes']['aria-describedby'])) {
$variables['attributes']['class'][] = 'description';
$variables['attributes']['id'] = $variables['attributes']['aria-describedby'];
// Remove aria-describedby attribute as it shouldn't be visible here.
unset($variables['attributes']['aria-describedby']);
}
}
/**
* Prepares variables for filter tips templates.
*
......
......@@ -6,6 +6,9 @@
* Available variables:
* - children: Text format element children.
* - description: Text format element description.
* - attributes: HTML attributes for the containing element.
*
* @see template_preprocess_text_format_wrapper()
*
* @ingroup themeable
*/
......@@ -13,6 +16,6 @@
<div class="text-format-wrapper form-item">
{{ children }}
{% if description %}
<div class="description">{{ description }}</div>
<div{{ attributes }}>{{ description }}</div>
{% endif %}
</div>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment