From b407af725f7c504a1a02b8af41816805c4a66b7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Mudr=C3=A1k?= Date: Wed, 29 Dec 2021 13:00:45 +0100 Subject: [PATCH] MDL-73464 book: Scroll to chapter top when navigating through the book When navigating to the next / previous chapter, the chapter should be the page element that gets the user's attention and focus. Its title should be displayed at the prominent top page area without the need to scroll to it all the time. --- mod/book/templates/main_action_menu.mustache | 4 ++-- mod/book/view.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mod/book/templates/main_action_menu.mustache b/mod/book/templates/main_action_menu.mustache index 282a64a9554..fcc206f9814 100644 --- a/mod/book/templates/main_action_menu.mustache +++ b/mod/book/templates/main_action_menu.mustache @@ -42,12 +42,12 @@
{{#previous}} {{/previous}} {{#next}} {{/next}}
diff --git a/mod/book/view.php b/mod/book/view.php index 57082db6939..68597a32fef 100644 --- a/mod/book/view.php +++ b/mod/book/view.php @@ -123,7 +123,7 @@ if (!$chapterid) { $renderer = $PAGE->get_renderer('mod_book'); $actionmenu = new \mod_book\output\main_action_menu($cm->id, $chapters, $chapter, $book); $renderedmenu = $renderer->render($actionmenu); - echo $renderedmenu; + echo html_writer::div($renderedmenu, '', ['id' => 'mod_book-chaptersnavigation']); // The chapter itself. $hidden = $chapter->hidden ? ' dimmed_text' : null;