Page MenuHomePhabricator

Wikidata tours: Reconcile versions of MediaWiki:Guidedtour-lib.js
Open, Needs TriagePublic

Assigned To
Authored By
Feb 12 2020, 12:01 PM
Referenced Files
"Burninate" token, awarded by Ijon."Stroopwafel" token, awarded by Saturae."Heartbreak" token, awarded by Alicia_Fagerving_WMSE."Stroopwafel" token, awarded by Richard_Nevell_WMUK."Heartbreak" token, awarded by John_Cummings.


We currently have at two versions of guided tour library, which really need to be reconciled in to one latest version working as well as possible.

I want to report all the outstanding issues with tours (there are lots!) but it does not make sense to do this until we sort out which versions are where and find the current best version to use and build on.

I've created a 3rd version which tries to take the best of each of the previous two versions, with the issues listed mostly resolved. It has a couple of hacks that need to be removed but I propose that we now work from this version as it's the most functional of all the options.

Here is a summary of what we have now:

v1 - The main library file is currently the same on test.wikidata and wikidata, except live version has comments explaining defined functions (test version has no comments)
Live library:
Test library:

This version has some recent changes that were supposed to fix T213704 (marked resolved but not fixed on live at present), using the Mutation Observer API.


  1. Does not fix issues lists in T213704 that latest changes are supposed to fix
  2. Fires the "onShow" function twice instead of once for most slides. When there is an actionBtn, this leads to the action being triggered twice. Not quite pinned down yet, but you can see this by clicking "next" on slide 3 in the example above. You will see that two "new statement" boxes are added. (new from MutationObserver fix)
  3. T244747: Wikidata Tours: Stepping back shows next and previous steps at once (new from MutationObserver fix)

v2 - A second improved library file is also present on test.wikidata, aiming to fix the issues reported in T213704: Wikidata Tours don't load correctly

Test library:


This version basically fixes the issue of un-attached guiders when a step reveals new html elements. However, it does have the issues listed below:


  1. Does not trigger the next slide when the user clicks on the actionBtn themselves. It only works when they click the "next" button.
  2. The T244994 fix has not worked for the "add statement" action, it only seems to work when the next step is revealed within a currently visible new statement box (e.g. "add qualifier", "add reference")

Note: there are several other issues which effect both versions but will be reported once we're all on one single version.

IMHO, we should quickly copy the v2 file ( over to live Wikidata. The current live version is quite broken, and although there are issues with v2 it does have much less wrong with it.


v3 - I've managed to create a new version now which takes the best of both version and fixes the issues listed with each one

See the comment 13th Feb below for details.


Related Objects

Event Timeline

For information, there are 14 new Wikidata Tours basically ready to publish T165903 which would provide a pretty comprehensive set of guidance for new users, they don't work until this bug is fixed :(

I would love to have the tours functioning on Wikidata.

Ijon added a subscriber: Ijon.

Yes yes yes! This is important. Usable tours are crucial for self-onboarding for volunteers not able to get in-person training.

@Lydia_Pintscher is there anyone at WMDE who could help with this? I've spent weeks putting together new tours for a Wikimedia Sverige competition starting Monday and they won't work without this fix :(

Hello all, thanks for preparing this ticket.
We're going to look into it as soon as possible. However, what I can say for sure is that this is not just an easy bug to fix, and we won't be able to change anything before Monday. I'm sorry for that.
I'll share more information with you when I can.

Thanks very much @Lea_Lacroix_WMDE , let me know if there's anything muggles can help with

@NavinoEvans As far as I understand, nothing prevents you to add MediaWiki:Guidedtour-lib2.js to yourself, right?

Yes that is indeed true @Lea_Lacroix_WMDE, I just wanted to make sure everyone was aware of the issue and check for any objections to copying over the new version. My hope is that we can then organise a git repository that everyone can contribute to avoid all the difficulty tracking what versions are where, but that will be another ticket ;)

Hi all, I think I've managed to combine the best of both versions and fix most of the outstanding issues I was planning to report.

There are some hacky parts which need to be resolved by making small changes to the guiders library, but for me this is fine to go live so we have everything working instead of broken. Then we can clean it up after some discussion over the coming weeks/months.

You can check how this tour works
Note: The reference slide is a bit mismatched with slide text and attachment as there's a new UI on test.wikidata.

What I've fixed is:

  • Next step is now triggered whether you click the next button or complete an action in the UI.
  • However you complete the step, the next slide will wait for the new elements to be loaded so that it can attach to it correctly (instead of floating in the middle of the page).
  • The onShow event only fires once, so you do not get actions repeated twice
  • Once a step is completed, the action will not be triggered again. This means you can move back/forward through steps without the actions repeating every time (and creating multiple "new statement" boxes for example)
  • Fixed T244747: Wikidata Tours: Stepping back shows next and previous steps at once

The main hack is that I've added a new actionBtn2 property in the step options. This is to prevent the automatic clicking on the actionBtn element whenever a slide advances (in the guiders library).
We need to wait to advance the slide until the DOM is ready with the element to attach the guider to.
The other hack is closely related, I just needed to remove the click event for the "next" button, so we could trigger the DOM change and wait for completion before advancing.

Does anyone have any objections to me adding this as the main new version? As well as temporarily changing the two tours we currently have live to use actionBtn2 instead of actionBtn.

I'm going to be bold and go ahead with updating the Guided Tours library to the new version I made on test.wikidata. I'm rushing it through as the finding GLAMs Challenge starts tomorrow and there are 5 new tours ready to be added that won't work correctly with the current version of the tours library.
The currently live 'items' and 'statements' tours also have serious issues that will resolve with the update.

I will copy over my latest version from test Wikidata shortly. The revision of the current live version is here in case anyone needs to refer to it or revert back:

A small update

We have now redesigned the main tours page and published some of the new tours, several more to come including a section on creating common kinds of items e.g people, museums etc based on schemas

Thanks a lot for your work! I'll add a note in the next newsletter.

@Lea_Lacroix_WMDE please wait a little but to share it, I've got several more to add and I want to redo the main Tours page

@Lea_Lacroix_WMDE also the tours don't work properly till this bug gets fixed so best hold off for now

@Mrjohncummings No problem, I removed the line from the newsletter.