Issue #1848684 by Liam Morland, mgifford: Add ARIA role to DETAILS.

8.0.x
webchick 2013-01-02 17:58:48 -08:00
parent 71b730adfb
commit 713e67743b
1 changed files with 9 additions and 1 deletions

View File

@ -2869,7 +2869,15 @@ function theme_details($variables) {
$output = '<details' . new Attribute($element['#attributes']) . '>';
if (!empty($element['#title'])) {
$output .= '<summary>' . $element['#title'] . '</summary>';
$summary_attributes = new Attribute(array(
'role' => 'button',
));
if (!empty($element['#attributes']['id'])) {
$summary_attributes['aria-controls'] = $element['#attributes']['id'];
}
$summary_attributes['aria-expanded'] = empty($element['#attributes']['open']) ? FALSE : TRUE;
$summary_attributes['aria-pressed'] = $summary_attributes['aria-expanded'];
$output .= '<summary' . $summary_attributes . '>' . $element['#title'] . '</summary>';
}
$output .= '<div class="details-wrapper">';
if (!empty($element['#description'])) {