Commit 713e6774 authored by webchick's avatar webchick

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

parent 71b730ad
......@@ -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'])) {
......
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