mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +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
d27c60a90a
commit
254aa09f40
1 changed files with 10 additions and 8 deletions
|
@ -4242,9 +4242,17 @@ EOD;
|
||||||
*/
|
*/
|
||||||
protected function render_context_header(context_header $contextheader) {
|
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']);
|
$showheader = empty($this->page->layout_options['nocontextheader']);
|
||||||
if (!$showheader) {
|
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.
|
// All the html stuff goes here.
|
||||||
|
@ -4257,13 +4265,7 @@ EOD;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Headings.
|
// Headings.
|
||||||
if (!isset($contextheader->heading)) {
|
$html .= html_writer::tag('div', $heading, array('class' => 'page-header-headings'));
|
||||||
$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'));
|
|
||||||
|
|
||||||
// Buttons.
|
// Buttons.
|
||||||
if (isset($contextheader->additionalbuttons)) {
|
if (isset($contextheader->additionalbuttons)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue