Page MenuHomePhabricator

[1.38.0-wmf.7] WikidataPageBanner: Disable mechanism of table of contents is no longer working on view mode
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • Pages should not have table of contents in view mode (just like the preview mode as per T295632)

What happens?:
For some reason, the table of contents are coming up on Wikivoyage, which is not usually normal. All mainspace pages do not usually have a table of contents, but ever since around 13:00 AEDT (UTC+11), this has been happening

What should have happened instead?:
The table of contents should have been restricted to the pagebanner

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc:

QA steps

Visit https://en.wikivoyage.beta.wmflabs.org/wiki/Salzburg
Expected: The vertical table of contents should not be present in the page. It should be present inside the banner image at the top of the page as a horizontal bar.

If the vertical table of contents is present in the page:

Screen Shot 2021-11-05 at 10.06.31 AM.png (656×644 px, 57 KB)

Click edit, and add some random text to see if it goes away.

QA Results - Beta

ACStatusDetails
1T295003#7497641

QA Results - Prod

ACStatusDetails
1T295003#7498914

Event Timeline

In fact, this table of contents does not appear in all articles or in all languages at the same time. Example : https://fr.wikivoyage.org/wiki/Spa in French or https://pl.wikivoyage.org/wiki/Spa in Polish has not table and https://en.wikivoyage.org/wiki/Spa_(Belgium) in English has a table.

Could someone please provide a link to an English WV page which has no table; or a French/Polish page which has a table, as the title here says "all language Wikivoyages" (plural)? So far I've only managed to see the problem on English WV which makes me think that something could be special about https://en.wikivoyage.org/wiki/Template:Pagebanner there.

(Note to myself: Both French WV and English WV are in group 1 and on the same 1.38.0-wmf.7 software version.)

https://fr.wikivoyage.org/wiki/Li%C3%A8ge in French and English has a table but not in other languages. I have tried to found an article in English without a table but without success

@Omondi , @Aklapper ,
the issue is on the pagebanner extension.
The reason why you didn't see it:

  • on fr:voy is just because of cache. Now I've purged the page and you can see it
  • on pl:voy is because they DON'T use the extension, so pl:voy is not affected.

The issue is on it:voy as well, but temporary I've patched both it:voy & en:voy with this script:

$(document).ready(function(e) {
	$(".ext-wpb-pagebanner").parent().parent().find("#toc").hide();
});

that hide the standard TOC when a pagebanner (generated by the extension) is present.

Andyrom75 renamed this task from Unwanted Table of Contents on all language Wikivoyages to Extension:WikidataPageBanner doesn't hide standard TOC on Wikivoyage.Nov 4 2021, 10:51 AM

The Spa article on fr.voy seems to have a table now. Clicking random articles on the French Wikivoyage, I can't seem to find any article without the table of contents.

Jdlrobson renamed this task from Extension:WikidataPageBanner doesn't hide standard TOC on Wikivoyage to __NOTOC__ no longer works on wikis where Extension:WikidataPageBanner is installed.Nov 4 2021, 10:26 PM
Jdlrobson renamed this task from __NOTOC__ no longer works on wikis where Extension:WikidataPageBanner is installed to WikidataPageBanner: Disable mechanism of table of contents is no longer working.
Jdlrobson triaged this task as High priority.
Jdlrobson subscribed.

@cscott WikidataPageBanner is using Parser internals in its code. I'm surprised it worked this long without problems :-( https://gerrit.wikimedia.org/g/mediawiki/extensions/WikidataPageBanner/+/162a33836470e9dfab9501a9602b5edc1b67140e/includes/WikidataPageBanner.php#210 I am going to see if I can make that a bit nicer. Is there an elegant way for extensions to disable table of contents on a page to provide their own? Perhaps, WikidataPageBanner should be setting __NOTOC__ on all pages.

Workarounds:

  • __NOTOC__ should work as a workaround here, provided __FORCETOC__ is not called.
  • Add #toc { display: none; } to MediaWiki:Common.css

I'd recommend Wikivoyage communities use __NOTOC__ regardless of what we end up with here.

Note, it's Thursday so unfortunately a fix will likely have to wait until next week but I'll make sure that gets prioritized.

https://fr.wikivoyage.org/wiki/Li%C3%A8ge in French and English has a table but not in other languages. I have tried to found an article in English without a table but without success

@Omondi it looks like French Wikipedia is calling __FORCETOC__ in https://fr.wikivoyage.org/w/index.php?title=Mod%C3%A8le:Banni%C3%A8re_page&action=edit removing that should address this problem for you.

@Andyrom75 let me know if adding __NOTOC__ to https://en.wikivoyage.org/w/index.php?title=Template:pagebanner is not practical.

@Jdlrobson is not possible to use the suggested CSS on MediaWiki:Common.css because it will affect ALL the pages, not only the ones that use the banner. That's why, the applied temporary patch use a dynamic JS that looks first for the ext-wpb-pagebanner class, introduced by the extension.
As well is not possible to use __NOTOC__ because it will hide also the custom banner menu (the one that replace the standard TOC)

Change 737088 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/WikidataPageBanner@master] WikidataPageBanner should disable table of contents using public functions

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

@Jdlrobson is not possible to use the suggested CSS on MediaWiki:Common.css because it will affect ALL the pages,

Right.. and WikidataPageBanner doesn't add a special class to the body tag when present.

As well is not possible to use NOTOC because it will hide also the custom banner menu (the one that replace the standard TOC)

@Andyrom75 yes you are right.

Change 737088 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

The above patch should fix this problem, but WikidataPageBanner was doing something it shouldn't have been doing. I'll need @cscott to review the approach though.

Change 737088 merged by jenkins-bot:

[mediawiki/extensions/WikidataPageBanner@master] WikidataPageBanner should disable table of contents using public functions

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

Change 737075 had a related patch set uploaded (by Jdlrobson; author: Jdlrobson):

[mediawiki/extensions/WikidataPageBanner@wmf/1.38.0-wmf.7] WikidataPageBanner should disable table of contents using public functions

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

Does someone know if there was a specific code change in the Parser that triggered this issue in WDPageBanner? Asking as T295187 is another recent ToC issue...

Jdlrobson raised the priority of this task from High to Unbreak Now!.Nov 8 2021, 3:39 PM

Backporting this shortly.

Jdlrobson renamed this task from WikidataPageBanner: Disable mechanism of table of contents is no longer working to [1.38.0-wmf.7] WikidataPageBanner: Disable mechanism of table of contents is no longer working.Nov 8 2021, 3:40 PM

Change 737075 merged by jenkins-bot:

[mediawiki/extensions/WikidataPageBanner@wmf/1.38.0-wmf.7] WikidataPageBanner should disable table of contents using public functions

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

Mentioned in SAL (#wikimedia-operations) [2021-11-08T19:39:31Z] <urbanecm@deploy1002> Synchronized php-1.38.0-wmf.7/extensions/WikidataPageBanner/includes/WikidataPageBanner.php: 2c74457b26e0d288a371fd76bcb91b697554f9fd: WikidataPageBanner should disable table of contents using public functions (T295003) (duration: 00m 55s)

Jdlrobson lowered the priority of this task from Unbreak Now! to Medium.Nov 8 2021, 7:45 PM

Hey all. This should now be fixed in production. https://en.wikivoyage.org/wiki/Salzburg?safemode=1

You should be able to safely remove any site CSS/JS you added.

Note for anonymous page views there still may be a duplicate table of contents, but you can fix that by running ?action=purge on that page.

Thanks @Jdlrobson! I've removed the patch several hours ago on it:voy and checked now to avoid cache issues; all works correctly. I've just removed the patch in en:voy and asked fr:voy & ru:voy to do the same. Without comments from their side I would say that we can close the ticket within tomorrow.

Thanks for confirming @Andyrom75 that's super helpful.

@Jdlrobson you can successfully close this ticket. Thanks a lot for your quick support!

Test Result - Beta

Status: ✅ PASS
Environment: beta wikivoyage
OS: macOS Big Sur
Browser: Chrome
Device: MBP
Emulated Device: NA

Test Artifact(s):

QA Steps

Visit https://en.wikivoyage.beta.wmflabs.org/wiki/Salzburg
✅ AC1: Expected: The vertical table of contents should not be present in the page. It should be present inside the banner image at the top of the page as a horizontal bar.

Screen Shot 2021-11-10 at 5.44.49 PM.png (1×928 px, 486 KB)

Edtadros subscribed.

Test Result - Prod

Status: ✅ PASS
Environment: enwikivoyage
OS: macOS Big Sur
Browser: Chrome
Device: MBP
Emulated Device: NA

Test Artifact(s):

QA Steps

Visit https://en.wikivoyage.org/wiki/Salzburg
✅ AC1: Expected: The vertical table of contents should not be present in the page. It should be present inside the banner image at the top of the page as a horizontal bar.

Screen Shot 2021-11-11 at 7.04.57 AM.png (491×1 px, 423 KB)

@Jdlrobson I've noticed another strange behavior. As previously mentioned, when visualizing an article everything is fine now, but during the preview the standard TOC is still visible. This is quite annoying because "what we see is NOT what we get" after publishing the content.
Do you want me to open another ticket or can this bug managed here with the same ticket?

Let me know

@Andyrom75 a new bug would be great. When reporting it could you mention which of the editors are impacted (e.g. VisualEditor, ?action=edit, mobile editor)?
I'm sadly out for the next 2 weeks so won't be able to look for at these for a while, but please add cscott to the ticket as he can likely help in the interim.

Andyrom75 renamed this task from [1.38.0-wmf.7] WikidataPageBanner: Disable mechanism of table of contents is no longer working to [1.38.0-wmf.7] WikidataPageBanner: Disable mechanism of table of contents is no longer working on view mode.Nov 13 2021, 7:10 AM

@Jdlrobson just opened T295632 as requested. If you can, give a quick look to be sure that as been correctly opened.

Thanks @Andyrom75! Resolving this task and will continue with follow up on T295632: [1.38.0-wmf.7] WikidataPageBanner: Disable mechanism of table of contents is no longer working on preview mode