';
if (!empty($element['#description'])) {
@@ -984,7 +988,7 @@ function theme_fieldset($variables) {
* An associative array containing:
* - element: An associative array containing the properties of the element.
* Properties used: #attributes, #children, #collapsed, #description, #id,
- * #title, #value.
+ * #title, #title_display.
*
* @ingroup themeable
*/
@@ -1010,9 +1014,7 @@ function theme_details($variables) {
$output .= '
' . $element['#description'] . '
';
}
$output .= $element['#children'];
- if (isset($element['#value'])) {
- $output .= $element['#value'];
- }
+
$output .= '
';
$output .= "\n";
return $output;
@@ -1250,11 +1252,15 @@ function theme_checkboxes($variables) {
}
/**
- * Adds form element theming to an element if its title or description is set.
+ * Adds theming to composite form elements such as checkboxes and radios.
*
- * This is used as a pre render function for checkboxes and radios.
+ * If either the title or description is set for the composite element as a * whole, then this adds either a 'fieldset' or 'form_element' theme wrapper to
+ * render them. A fieldset is generally preferred to assist screen readers
+ * (http://webaim.org/techniques/forms/screen_reader#group), but is not used
+ * when #title_display is set to an option impossible to render as a fieldset
+ * legend.
*/
-function form_pre_render_conditional_form_element($element) {
+function form_pre_render_composite_form_element($element) {
// Set the element's title attribute to show #title as a tooltip, if needed.
if (isset($element['#title']) && $element['#title_display'] == 'attribute') {
$element['#attributes']['title'] = $element['#title'];
@@ -1265,7 +1271,16 @@ function form_pre_render_conditional_form_element($element) {
}
if (isset($element['#title']) || isset($element['#description'])) {
- $element['#theme_wrappers'][] = 'form_element';
+ // To assist screen readers, use a fieldset wrapper when possible, but
+ // fieldset legends are only compatible with the 'before' and 'invisible'
+ // options for #title_display.
+ if (!isset($element['#title_display']) || in_array($element['#title_display'], array('before', 'invisible'))) {
+ $wrapper = 'fieldset';
+ }
+ else {
+ $wrapper = 'form_element';
+ }
+ $element['#theme_wrappers'][] = $wrapper;
}
return $element;
}
@@ -2709,7 +2724,7 @@ function form_process_file($element) {
* property hides the label for everyone except screen readers.
* - attribute: Set the title attribute on the element to create a tooltip
* but output no label element. This is supported only for checkboxes
- * and radios in form_pre_render_conditional_form_element(). It is used
+ * and radios in form_pre_render_composite_form_element(). It is used
* where a visual label is not needed, such as a table of checkboxes where
* the row and column provide the context. The tooltip will include the
* title and required marker.
diff --git a/core/modules/system/system.module b/core/modules/system/system.module
index 3fb3f04..eedd2c3 100644
--- a/core/modules/system/system.module
+++ b/core/modules/system/system.module
@@ -440,7 +440,7 @@ function system_element_info() {
'#input' => TRUE,
'#process' => array('form_process_radios'),
'#theme_wrappers' => array('radios'),
- '#pre_render' => array('form_pre_render_conditional_form_element'),
+ '#pre_render' => array('form_pre_render_composite_form_element'),
);
$types['radio'] = array(
'#input' => TRUE,
@@ -454,7 +454,7 @@ function system_element_info() {
$types['checkboxes'] = array(
'#input' => TRUE,
'#process' => array('form_process_checkboxes'),
- '#pre_render' => array('form_pre_render_conditional_form_element'),
+ '#pre_render' => array('form_pre_render_composite_form_element'),
'#theme_wrappers' => array('checkboxes'),
);
$types['checkbox'] = array(
diff --git a/core/themes/seven/style.css b/core/themes/seven/style.css
index 11f9846..155eae0 100644
--- a/core/themes/seven/style.css
+++ b/core/themes/seven/style.css
@@ -25,6 +25,8 @@ hr {
summary,
legend {
font-weight: bold;
+}
+summary {
text-transform: uppercase;
}
h1,