We noticed that in courses with topics or weeks formats, when switching sections, the loading animation would push the section that was active down as it's being displayed. The previous behaviour was the animation showing and the section being hidden.
I looked into it and found the cause of this issue. In the Moodle 3.9 branch, the
tag containing the different course sections would be created with echo $this->start_section_list(); and get a class of 'topics' or 'weeks', depending on the course format.
Then, when changing section, javascript will hide the elements matching the following pattern $('.course-content .' + self.courseConfig.format + ' li[id^="section-"]') when retrieving a new section, before displaying it (https://github.com/open-lms-open-source/moodle-theme_snap/blob/master/amd/src/section_asset_management.js#L180).
This is now broken, as in 4.1, the class is set to 'sections', which does not match the possible course formats.
Our solution was to change
$('.course-content .' + self.courseConfig.format + ' li[id^="section-"]').hide();
to be
$('.course-content .sections li[id^="section-"]').hide();
If you are happy with this approach, let me know and I'll create a pull request.
Hi team,
We noticed that in courses with topics or weeks formats, when switching sections, the loading animation would push the section that was active down as it's being displayed. The previous behaviour was the animation showing and the section being hidden.
I looked into it and found the cause of this issue. In the Moodle 3.9 branch, the
tag containing the different course sections would be created with
echo $this->start_section_list();
and get a class of 'topics' or 'weeks', depending on the course format. Then, when changing section, javascript will hide the elements matching the following pattern $('.course-content .' + self.courseConfig.format + ' li[id^="section-"]') when retrieving a new section, before displaying it (https://github.com/open-lms-open-source/moodle-theme_snap/blob/master/amd/src/section_asset_management.js#L180).This is now broken, as in 4.1, the class is set to 'sections', which does not match the possible course formats.
Our solution was to change
$('.course-content .' + self.courseConfig.format + ' li[id^="section-"]').hide();
to be$('.course-content .sections li[id^="section-"]').hide();
If you are happy with this approach, let me know and I'll create a pull request.