From 6ca7da74ca6d0c0013e2cbad4d4a2d682afe9460 Mon Sep 17 00:00:00 2001 From: Rajneel Totaram Date: Wed, 13 Aug 2025 19:09:35 +1200 Subject: [PATCH] MDL-86202 mod_lesson: Use correct heading level --- public/mod/lesson/tests/behat/lesson_review.feature | 5 +++++ public/mod/lesson/view.php | 5 +++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/public/mod/lesson/tests/behat/lesson_review.feature b/public/mod/lesson/tests/behat/lesson_review.feature index b608266da5e..3c4052537c3 100644 --- a/public/mod/lesson/tests/behat/lesson_review.feature +++ b/public/mod/lesson/tests/behat/lesson_review.feature @@ -4,6 +4,7 @@ Feature: In a lesson activity, students can review the answers they gave to ques As a student I need to complete a lesson answering all of the questions. + @javascript @accessibility Scenario: Student answers questions and then reviews them. Given the following "users" exist: | username | firstname | lastname | email | @@ -89,3 +90,7 @@ Feature: In a lesson activity, students can review the answers they gave to ques And I should see "Correct answer 2" And I press "Continue" And I should see "Congratulations - end of lesson reached" + # Check assessibility at the lesson start page. + # Attempts heading should be at correct heading level. + And I am on the "Test lesson name" "lesson activity" page + And the "[role=main]" "css_element" should meet accessibility standards with "best-practice" extra tests diff --git a/public/mod/lesson/view.php b/public/mod/lesson/view.php index b05ca887569..16f8e4d3efa 100644 --- a/public/mod/lesson/view.php +++ b/public/mod/lesson/view.php @@ -242,8 +242,9 @@ if ($pageid != LESSON_EOL) { echo $lessonoutput->render($editbuttons); if ($attemptflag) { - // We are using level 3 header because attempt heading is a sub-heading of lesson title (MDL-30911). - echo $OUTPUT->heading(get_string('attempt', 'lesson', $retries), 3); + // Get correct heading level for the attempts heading. + $headinglevel = $PAGE->activityheader->get_heading_level(); + echo $OUTPUT->heading(get_string('attempt', 'lesson', $retries), $headinglevel); } // This calculates and prints the ongoing score. if ($lesson->ongoing && !empty($pageid) && !$reviewmode) {