-
Bug
-
Resolution: Fixed
-
Major
-
3.8
-
MOODLE_38_STABLE
-
MOODLE_38_STABLE
-
MDL-67117-master-2 -
In Moodle 3.8 new code was added to theme/boost/amd/src/loader.js that replaces the URL with the tab name when switching to the tab.
Moodle Workplace had similar code since 3.7 but it was causing scrolling so we created a workaround. In 3.8 we are trying to use the core functionality but the page keeps scrolling.
After several hours of debugging I figured out that it is MathJax filter that causes the page to scroll.
- Use attached test files "testtabs.php", place it in wwwroot and open in the browser
- Click on the second tab, you will notice scrolling
- Go to "Site aministration>Plugins>Manage filters" and disable MathJax filter
- Go back to testtabs.php
- Now if you click on second tab the page does not scroll
- (Enable filter back)
Why it happens:
When we click on the second tab we want to dynamically load content, so we use "Templates.replaceNodeContents", which calls "event.notifyFilterContentUpdated(newNodes);"
MathJax filter listens to this event and tries to substitute the mathjax content. Even if there is no mathjax content in the new nodes, it still calls function "_setLocale()" which calls "window.MathJax.Hub.Configured()"
The later causes scrolling. Why? No idea. I could not find anything while googling.
If you remove this line
https://github.com/moodle/moodle/blob/master/filter/mathjaxloader/yui/src/loader/js/loader.js#L81
scrolling stops happening.
I would REALLY appreciate help on this, it's quite critical in upgrading Moodle Workplace to 3.8. Also it will become a problem for any users of bootstrap tabs in 3.8 with dynamically loaded content.