Skip to content

Commit

Permalink
[4.0] html5 chrome fix [a11y] and markup (joomla#31772)
Browse files Browse the repository at this point in the history
Co-authored-by: Quy <[email protected]>
  • Loading branch information
brianteeman and Quy authored Jan 1, 2021
1 parent 95680f5 commit d55e7fa
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions layouts/chromes/html5.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,23 @@
$headerTag = htmlspecialchars($params->get('header_tag', 'h3'), ENT_QUOTES, 'UTF-8');
$headerClass = htmlspecialchars($params->get('header_class', ''), ENT_QUOTES, 'UTF-8');
$headerAttribs = [];
$headerAttribs['class'] = $headerClass;

if ($module->showtitle) :
$moduleAttribs['aria-labelledby'] = 'mod-' . $module->id;
$headerAttribs['id'] = 'mod-' . $module->id;
else:
$moduleAttribs['aria-label'] = $module->title;
endif;

// Only output a header class if one is set
if ($headerClass !== '')
{
$headerAttribs['class'] = $headerClass;
}

// Only add aria if the moduleTag is not a div
if ($moduleTag !== 'div')
{
if ($module->showtitle) :
$moduleAttribs['aria-labelledby'] = 'mod-' . $module->id;
$headerAttribs['id'] = 'mod-' . $module->id;
else:
$moduleAttribs['aria-label'] = $module->title;
endif;
}

$header = '<' . $headerTag . ' ' . ArrayHelper::toString($headerAttribs) . '>' . $module->title . '</' . $headerTag . '>';
?>
Expand Down

0 comments on commit d55e7fa

Please sign in to comment.