diff --git a/webform.module b/webform.module index a0be5e2..89645b6 100644 --- a/webform.module +++ b/webform.module @@ -3591,6 +3591,11 @@ function theme_webform_element($variables) { } } + if (!empty($element['#description'])) { + $description_id = $element['#id'] . '--description'; + $element['#children'] = str_replace('aria-describedby="--WEBFORM-PLACEHOLDER--"', 'aria-describedby="' . $description_id . '"', $element['#children']); + } + switch ($element['#title_display']) { case 'inline': case 'before': @@ -3612,7 +3617,7 @@ function theme_webform_element($variables) { } if (!empty($element['#description'])) { - $output .= '
' . $element['#description'] . "
\n"; + $output .= '
' . $element['#description'] . "
\n"; } $output .= "\n"; @@ -4690,6 +4695,9 @@ function _webform_component_classes(&$element, $component) { $element['#wrapper_attributes']['class'] = isset($element['#wrapper_attributes']['class']) ? $element['#wrapper_attributes']['class'] : array(); $element['#wrapper_attributes']['class'] = array_merge($element['#wrapper_attributes']['class'], explode(' ' , $component['extra']['wrapper_classes'])); } + if (!empty($element['#description'])) { + $element['#attributes']['aria-describedby'] = '--WEBFORM-PLACEHOLDER--'; + } } /**