Commit 1f5cb1a7 authored by webchick's avatar webchick

Issue #1645420 by Liam Morland, mgifford: Added Use @aria-describedby for fieldset descriptions.

parent 95d46136
...@@ -2795,6 +2795,11 @@ function theme_fieldset($variables) { ...@@ -2795,6 +2795,11 @@ function theme_fieldset($variables) {
element_set_attributes($element, array('id')); element_set_attributes($element, array('id'));
_form_set_attributes($element, array('form-wrapper')); _form_set_attributes($element, array('form-wrapper'));
if (!empty($element['#description'])) {
$description_id = $element['#attributes']['id'] . '--description';
$element['#attributes']['aria-describedby'] = $description_id;
}
$output = '<fieldset' . new Attribute($element['#attributes']) . '>'; $output = '<fieldset' . new Attribute($element['#attributes']) . '>';
if (!empty($element['#title'])) { if (!empty($element['#title'])) {
// Always wrap fieldset legends in a SPAN for CSS positioning. // Always wrap fieldset legends in a SPAN for CSS positioning.
...@@ -2802,7 +2807,9 @@ function theme_fieldset($variables) { ...@@ -2802,7 +2807,9 @@ function theme_fieldset($variables) {
} }
$output .= '<div class="fieldset-wrapper">'; $output .= '<div class="fieldset-wrapper">';
if (!empty($element['#description'])) { if (!empty($element['#description'])) {
$output .= '<div class="fieldset-description">' . $element['#description'] . '</div>'; $attributes = array('class' => 'fieldset-description', 'id' => $description_id);
$output .= '<div' . new Attribute($attributes) . '>' . $element['#description'] . '</div>';
} }
$output .= $element['#children']; $output .= $element['#children'];
if (isset($element['#value'])) { if (isset($element['#value'])) {
......
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