mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-70173 output: All pages should have a heading
In MDL-63040, it was decided that the page header for the dashboad page should be removed. However, Based on Success Criteria 1.3.1 and 2.4.6 from the WebAIM's WCAG 2 Checklist, all pages should have an <h1> element. So I put an sr-only heading on the dashboard and all other pages, where no page header is shown.
This commit is contained in:
parent
3a9fa051c3
commit
c0e3a4108c
@ -4240,9 +4240,17 @@ EOD;
|
||||
*/
|
||||
protected function render_context_header(context_header $contextheader) {
|
||||
|
||||
// Generate the heading first and before everything else as we might have to do an early return.
|
||||
if (!isset($contextheader->heading)) {
|
||||
$heading = $this->heading($this->page->heading, $contextheader->headinglevel);
|
||||
} else {
|
||||
$heading = $this->heading($contextheader->heading, $contextheader->headinglevel);
|
||||
}
|
||||
|
||||
$showheader = empty($this->page->layout_options['nocontextheader']);
|
||||
if (!$showheader) {
|
||||
return '';
|
||||
// Return the heading wrapped in an sr-only element so it is only visible to screen-readers.
|
||||
return html_writer::div($heading, 'sr-only');
|
||||
}
|
||||
|
||||
// All the html stuff goes here.
|
||||
@ -4255,13 +4263,7 @@ EOD;
|
||||
}
|
||||
|
||||
// Headings.
|
||||
if (!isset($contextheader->heading)) {
|
||||
$headings = $this->heading($this->page->heading, $contextheader->headinglevel);
|
||||
} else {
|
||||
$headings = $this->heading($contextheader->heading, $contextheader->headinglevel);
|
||||
}
|
||||
|
||||
$html .= html_writer::tag('div', $headings, array('class' => 'page-header-headings'));
|
||||
$html .= html_writer::tag('div', $heading, array('class' => 'page-header-headings'));
|
||||
|
||||
// Buttons.
|
||||
if (isset($contextheader->additionalbuttons)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user