Problem/Motivation
The module already is so friendly to expose the following triggers on the document:
model
// Allow other scripts to respond to tour events.
.on('change:isActive', (tourModel, isActive) => {
$(document).trigger(
isActive ? 'drupalTourStarted' : 'drupalTourStopped',
);
});
(tour.js)
But this is only for the tour start and end.
It might be helpful to also trigger on each tour step or add an example in the README how to get the Shepherd events for that.
An example case would be to execute a callback when the next step is made.
Does anyone know how to solve that correctly and with a good DX?
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Comments
Comment #2
anybodyComment #3
anybodyComment #4
thomas.frobieterExample usage: Use the 'before-show' step event to trigger the required clicks to make anything visible (e.g. a submenu trail or an expandable element) before the tip is shown on something inside this originally hidden element.
Comment #5
anybody@grevil: Could you please check if it's possible to subscribe on the step events from Shepherd.js within
If yes, we should add some of these snippets to the README for the Shepherd tour and step events! Then it wouldn't need further triggers here.
PS: please note that you may probably need to use jQuery, as I think to remember that $().trigger doesn't trigger native JS events. Maybe we could also add a vanilla js trigger besides the jQuery one, if I'm correct.
Comment #6
anybody@thomas.frobieter this is already possible, as @grevil found out. Here's a nice code example how to get the steps once the tour is started:
https://git.drupalcode.org/project/tour_extras/-/blob/1.x/modules/tour_e...
Comment #8
smustgrave commentedCan we re-purpose this ticket to add that module to the README.
Comment #10
smustgrave commentedAdded to the README and credited everyone from the tours extra module
Comment #12
anybodyThank you!!