Skip to content
Snippets Groups Projects
Commit 713e6774 authored by Angie Byron's avatar Angie Byron
Browse files

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

parent 71b730ad
No related branches found
No related tags found
No related merge requests found
......@@ -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'])) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment