diff --git a/core/modules/filter/filter.module b/core/modules/filter/filter.module index 3fa834b..d31cca1 100644 --- a/core/modules/filter/filter.module +++ b/core/modules/filter/filter.module @@ -733,9 +733,6 @@ function _filter_tips($format_id, $long = FALSE) { */ function template_preprocess_filter_guidelines(&$variables) { $format = $variables['format']; - $variables['attributes']['class'][] = 'filter-guidelines-item'; - $variables['attributes']['class'][] = 'filter-guidelines-' . $format->format; - $variables['tips'] = array( '#theme' => 'filter_tips', '#tips' => _filter_tips($format->format, FALSE), @@ -752,9 +749,10 @@ function template_preprocess_filter_guidelines(&$variables) { * - attributes: An associative array containing properties of the element. */ function template_preprocess_text_format_wrapper(&$variables) { + $variables['aria_description'] = FALSE; // Add element class and id for screen readers. if (isset($variables['attributes']['aria-describedby'])) { - $variables['attributes']['class'][] = 'description'; + $variables['aria_description'] = TRUE; $variables['attributes']['id'] = $variables['attributes']['aria-describedby']; // Remove aria-describedby attribute as it shouldn't be visible here. unset($variables['attributes']['aria-describedby']); @@ -788,25 +786,14 @@ function template_preprocess_text_format_wrapper(&$variables) { */ function template_preprocess_filter_tips(&$variables) { $tips = $variables['tips']; - $long = $variables['long']; foreach ($variables['tips'] as $name => $tiplist) { foreach ($tiplist as $tip_key => $tip) { - $tiplist[$tip_key]['attributes'] = new Attribute(array()); - if ($long) { - $tiplist[$tip_key]['attributes']['class'] = array('filter-' . str_replace("/", "-", $tip['id'])); - } + $tiplist[$tip_key]['attributes'] = new Attribute(); } - $attributes = array( - 'class' => array( - 'filter-type', - 'filter-' . drupal_html_class($name), - ), - ); - $variables['tips'][$name] = array( - 'attributes' => new Attribute($attributes), + 'attributes' => new Attribute(), 'name' => String::checkPlain($name), 'list' => $tiplist, ); diff --git a/core/modules/filter/templates/filter-guidelines.html.twig b/core/modules/filter/templates/filter-guidelines.html.twig index ecf9b94..4341349 100644 --- a/core/modules/filter/templates/filter-guidelines.html.twig +++ b/core/modules/filter/templates/filter-guidelines.html.twig @@ -19,7 +19,13 @@ * @ingroup themeable */ #} - +{% + set classes = [ + 'filter-guidelines-item', + 'filter-guidelines-' ~ format.format, + ] +%} +

{{ format.name }}

{{ tips }} diff --git a/core/modules/filter/templates/filter-tips.html.twig b/core/modules/filter/templates/filter-tips.html.twig index d8f70cb..b17de01 100644 --- a/core/modules/filter/templates/filter-tips.html.twig +++ b/core/modules/filter/templates/filter-tips.html.twig @@ -27,16 +27,27 @@
{% endif %} - {% for tip in tips %} + {% for name, tip in tips %} {% if multiple %} - + {% + set tip_classes = [ + 'filter-type', + 'filter-' ~ name|clean_class, + ] + %} +

{{ tip.name }}

{% endif %} {% if tip.list|length %}
    {% for item in tip.list %} - {{ item.tip }} + {% + set item_classes = [ + long ? 'filter-' ~ item.id|replace({'/': '-'}), + ] + %} + {{ item.tip }} {% endfor %}
{% endif %} diff --git a/core/modules/filter/templates/text-format-wrapper.html.twig b/core/modules/filter/templates/text-format-wrapper.html.twig index b4ff1cc..4e5ff6d 100644 --- a/core/modules/filter/templates/text-format-wrapper.html.twig +++ b/core/modules/filter/templates/text-format-wrapper.html.twig @@ -7,6 +7,8 @@ * - children: Text format element children. * - description: Text format element description. * - attributes: HTML attributes for the containing element. + * - aria_description: Flag for whether or not an ARIA description has been + * added to the description container. * * @see template_preprocess_text_format_wrapper() * @@ -16,6 +18,11 @@
{{ children }} {% if description %} - {{ description }}
+ {% + set classes = [ + aria_description ? 'description', + ] + %} + {{ description }}
{% endif %}