[LearnR] Site home to display the block drawer by default

[LearnR] Site home to display the block drawer by default

by Visvanath Ratnaweera -
Number of replies: 1
Picture of Particularly helpful Moodlers Picture of Translators
Moodle 4.1, LearnR v4.2.r8 (2023071008) Currently the home page of the site is shown to the visitor (not logged in) with the block drawer closed - only an arrow to open it. How can I make it to be open by default?
Average of ratings: -
In reply to Visvanath Ratnaweera

Re: [LearnR] Site home to display the block drawer by default

by Bob Gilmore -
Picture of Particularly helpful Moodlers
Hey Visvanath. This problem isn't just a LearnR theme problem, but one for any boost based theme.

There are a couple of fixes that work. My preferred one is to use the Admin > Appearance > Additional HTML > Within Head:

<script>
window.addEventListener('load', () => {
   if( window.matchMedia('(min-width: 700px)') ) {
document.querySelector('#page-site-index .drawer-right-toggle button').click();
} });
</script>

This forces the block drawer open on the site index only and only if the page is greater than 700px wide.  For every page on the site, remove #page-site-index from the query selector.

If you feel comfortable building a child theme or even hacking the boost code, this tracker item https://tracker.moodle.org/browse/MDL-75303 has a means of modifying the code to achieve the same result.



Average of ratings: Useful (1)