Page MenuHomePhabricator

shouldSkip and transition do not properly execute on next/prev
Closed, ResolvedPublic

Description

shouldSkip used to execute correctly when you clicked next. It would first get the ID of the next guider, then see if skipping was needed. See https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FGuidedTour.git/40e856360e4ba377242c172b036477aebf740ad9/modules%2Fmediawiki.libs.guiders%2Fmediawiki.libs.guiders.js#L774 .

The same should happen with transition, but now it works for neither legacy shouldSkip nor AFAICT transition.

For an example of the regression on legacy, try going to https://en.wikipedia.org/wiki/Wikipedia:TWA/1/Start?tour=twa1&step=6 then click next.

There is a shouldSkip on step 7 (the one you hit when you click next):

shouldSkip: function () {
                return mw.config.get( 'wgUserId' )  !== null;
}

Thus, it should automatically skip step 7, since you're logged in. However, this doesn't work.

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:46 AM
bzimport set Reference to bz71927.
bzimport added a subscriber: Unknown Object (MLST).
Deskana renamed this task from shouldSkip and transition do not properly execute on next/prev to VisualEditor.Aug 30 2018, 1:31 PM
Deskana renamed this task from VisualEditor to shouldSkip and transition do not properly execute on next/prev.Aug 30 2018, 1:47 PM
This comment was removed by Pppery.

Took a quick look at this and found it was more complicated to fix than my level of motivation to fix it, or what is likely to get reviewed.

Change #1031113 had a related patch set uploaded (by Pppery; author: Pppery):

[mediawiki/extensions/GuidedTour@master] Pass transition event when clicking next or back

https://gerrit.wikimedia.org/r/1031113

I've worked around this in the Wikipedia Adventure itself, but it should still be fixed for the future.

Change #1031113 merged by jenkins-bot:

[mediawiki/extensions/GuidedTour@master] Add setting to pass transition event when clicking next or back

https://gerrit.wikimedia.org/r/1031113

Michael subscribed.

Adding User-notice here, because there have been a couple of changes to GuidedTours that will roll out with the next train:

  • @Pppery's change finally fixes this 10-year old bug, now transitions() and shouldSkip() callbacks of a step are run when the user clicks then next/back buttons. But tours need to opt in to the fix by setting emitTransitionOnStep to true on the tour definition!
  • GuidedTours now support dark-mode! It was added in support dark-mode by using tokens for colors and cdx-button for close for T370454
  • (minor): A new flag allowAutomaticBack has been added to allow tour-authors to fix a problem with duplicate or otherwise undesired back-buttons (see T365275)

With all these changes, it would be a good idea if maintainers of on-wiki tours check their tours. Especially, whether anything looks funny with dark-mode.

Documentation still needs to be added to the on-wiki docs like https://www.mediawiki.org/wiki/Extension:GuidedTour/Write_an_on-wiki_tour