summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwebchick2012-11-29 07:16:36 (GMT)
committerwebchick2012-11-29 07:16:36 (GMT)
commit1f5cb1a7178aa537199052c95a7fdcaecacbc3a8 (patch)
treeb3516ff3ff7d69e27a0e677fe5ae52c6ab4cabf8
parent95d46136d3e85082bcac0ac80a344d95f2cfed78 (diff)
Issue #1645420 by Liam Morland, mgifford: Added Use @aria-describedby for fieldset descriptions.
-rw-r--r--core/includes/form.inc9
1 files changed, 8 insertions, 1 deletions
diff --git a/core/includes/form.inc b/core/includes/form.inc
index 002de6f..82e1f3d 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -2795,6 +2795,11 @@ function theme_fieldset($variables) {
element_set_attributes($element, array('id'));
_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']) . '>';
if (!empty($element['#title'])) {
// Always wrap fieldset legends in a SPAN for CSS positioning.
@@ -2802,7 +2807,9 @@ function theme_fieldset($variables) {
}
$output .= '<div class="fieldset-wrapper">';
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'];
if (isset($element['#value'])) {