Page MenuHomePhabricator

New Vector TOC is not shown when viewing a diff with preview
Closed, ResolvedPublic

Description

New Vector TOC is not shown when viewing a diff.

When I visit https://www.mediawiki.org/wiki/Help:Page_status_indicators?useskin=vector-2022, I see the floating TOC:

image.png (2×3 px, 685 KB)

But when I visit https://www.mediawiki.org/w/index.php?title=Help:Page_status_indicators&diff=prev&oldid=5285968&diffmode=source&diffonly=0&useskin=vector-2022, I see the old TOC unstyled:

image.png (2×3 px, 515 KB)

QA Results - Prod

ACStatusDetails
1T311529#8207451

Event Timeline

Jdlrobson renamed this task from New Vector TOC is not shown when viewing a diff to New Vector TOC is not shown when viewing a diff with preview.Jul 1 2022, 3:12 PM
Jdlrobson subscribed.

This is a problem with the diff page itself. The diff page overrides the parser output associated with the page and does not pass the toc option.

Something like this in includes/diff/DifferenceEngine.php should fix it:

		if ( $parserOutput ) {
					// Allow extensions to change parser output here
					if ( $this->hookRunner->onDifferenceEngineRenderRevisionAddParserOutput(
						$this, $out, $parserOutput, $wikiPage )
					) {
						$skinOptions = $this->getSkin()->getOptions();
						$out->setSections( $parserOutput->getSections() );
						$out->addParserOutput( $parserOutput, [
							'injectTOC' => $skinOptions['toc'],
							'enableSectionEditLinks' => $this->mNewRevisionRecord->isCurrent()
								&& $this->getAuthority()->probablyCan(
									'edit',
									$this->mNewRevisionRecord->getPage()
								),
							'absoluteURLs' => $this->slotDiffOptions['expand-url'] ?? false
						] );
					}
				}

@JMcLeod_WMF Just want to make sure this in on your radar, thanks!

Снимок экрана 2022-08-04 152727.png (651×1 px, 93 KB)

Now it looks like a list with bullets (and numbers)

Снимок экрана 2022-08-04 152727.png (651×1 px, 93 KB)

Now it looks like a list with bullets (and numbers)

The skin does not expect it to be within the article so is not loading styles for it. That's what it looks like unstyled.

The fix is described in T311529#8075720

like unstyled.

Then why were these styles on the first screenshots a month ago?

image.png (2×3 px, 515 KB)

like unstyled.

Then why were these styles on the first screenshots a month ago?

image.png (2×3 px, 515 KB)

At that time we were running an A/B test and loading both styles for both variants.

Now it looks like a list with bullets (and numbers)

Looks like this is a separate issue, filed as T314254: Templates: CSS classes (toccolours, toc) related to TOC lost styling in Vector-2022.

MSantos subscribed.

It doesn't seem that there's something actionable on Parsoid side. Please re-add the tag in case I'm missing something.

@MSantos this is the legacy parser so we need some input from @cscott

The approach proposed in T311529#8075720 seems reasonable to me. We might want to involve @daniel on patch review just because this is "yet another" way that wikitext is turned into a ParserOutput, although in this case at least the ParserOptions aren't involved.

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

[mediawiki/core@master] DifferenceEngine: Should respect skin option for rendering table of contents

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

Jdlrobson triaged this task as High priority.

Change 823519 merged by jenkins-bot:

[mediawiki/core@master] DifferenceEngine: Should respect skin option for rendering table of contents

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

Edtadros subscribed.

Test Result - Prod

Status: ✅ PASS
Environment: mediawiki
OS: macOS Monterey
Browser: Chrome
Device: MBP
Emulated Device:NA

Test Artifact(s):

QA Steps

✅ AC1: https://www.mediawiki.org/w/index.php?title=Help:Page_status_indicators&diff=prev&oldid=5285968&diffmode=source&diffonly=0&useskin=vector-2022 should display the new TOC.

Screen Shot 2022-09-01 at 4.11.43 PM.png (519×1 px, 107 KB)

Looks good, resolving