-
Improvement
-
Resolution: Unresolved
-
Minor
-
None
-
3.10.10
-
None
-
MOODLE_310_STABLE
Context:
Currently, the \tool_usertours\helpers::bootstrap() method is called once per page. This method is responsible for detecting if there is any applicable usertours on the current URL and list of activated user tours.
There is also the possibility to limit showing usertours according to specific CSS selector (a list of CSS classes or whatever it can be a CSS selector).
There can be content loaded dynamically via AJAX.
There is the JS event 'core_filters/contentUpdated', which can be triggered using filterEvents.notifyFilterContentUpdated(newNodes); , to inform about changes on the current content of the page.
Problem:
In a timeline, bootstrapping of usertours depends on the current content of the page, specially when CSS selectors applies. If you have a user tour that would be shown after some HTML content loaded via AJAX, with some specific CSS class specified as CSS selector in that usertour, the usertour is not shown, neither the link on the footer for resetting the usertour is shown.
Proposal:
This approach was proposed on the Moodle Dev Channel, thanks to Tim Hunt contribution.
The idea would be to use the JS event core_filters/contentUpdated on the usertours side, so that usertours registers an observer for that event. Upon core_filters/contentUpdated triggering, usertours would have to recheck if any usertour is now applicable of if there is a new with high priority to show and/or to prepare the link on the footer for "resetting" the usertour and to show it agin when clicked.
Above all, the expected behavior would be that as if all the HTML content was actually on the page at the beginning and not dynamically.
Possible downsides/effects:
- Once loading the usertours, before dynamic content, the page could show a usertour since it is applicable.
- After dynamic content is loaded, maybe another usertour with higher priority should be shown. This could bring the user to show/visit two different usertours.
Of course, the dynamically loaded content via AJAX side should trigger that event if interested on Moodle revisitint the new content from any registered observer, including the proposed new usertours' observer.
Final remark:
This issue should discuss if tool_usertours should listen for the JS event core_filters/contentUpdated and react correspondingly. If so, implement it.