Page MenuHomePhabricator

Table of contents subsection toggle buttons missing label
Closed, ResolvedPublic2 Estimated Story PointsBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Go to a wiki page with a table of contents with subsection toggles
  • Inspect the toggles (.vector-toc-toggle) and see there is no label

What should have happened instead?:
There should be some sort of text inside the button element, this is a regression

Software version (skip for WMF-hosted wikis like Wikipedia):

Other information (browser name/version, screenshots, etc.):

Developer notes

The following line in VectorComponentTableofContents.php is supposed to provide the label. Probably something is wrong with the PHP or mustache.
$this->localizer->msg( 'vector-toc-toggle-button-label', $section['line'] )->text();

We should also make sure that this is covered by jest snapshot tests

Event Timeline

skins/Vector/includes/Components/VectorComponentTableOfContents.php:73 - skins/Vector/includes/Components/VectorComponentTableOfContents.php:78

foreach ( $sections as &$section ) {
	if ( $section['is-top-level-section'] && $section['is-parent-section'] ) {
		$section['vector-button-label'] =
		$this->localizer->msg( 'vector-toc-toggle-button-label', $section['line'] )->text();
	}
}

that was moved to the component in Bug: T317900 https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/867701 from skins/Vector/includes/SkinVector22.php:66 - skins/Vector/includes/SkinVector22.php:71 with virtually no changes.

foreach ( $tocData[ 'array-sections' ] as &$section ) {
	if ( $section['is-top-level-section'] && $section['is-parent-section'] ) {
		$section['vector-button-label'] =
		$this->msg( 'vector-toc-toggle-button-label', $section['line'] )->text();
	}
}

and as it shows we only add the labels for top level parents, regardless even top level parents are not being assigned since $sections is detached from the parent array Toc Data and not being assigned back in the new code.

Change 889570 had a related patch set uploaded (by Mabualruz; author: Mabualruz):

[mediawiki/skins/Vector@master] Table of contents subsection toggle buttons missing label

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

Change 889570 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Table of contents subsection toggle buttons missing label

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

Test Result - Beta

Status: ✅ PASS
Environment: beta
OS: macOS Ventura
Browser: Chrome
Device: MBP
Emulated Device:NA

Test Artifact(s):

QA Steps

✅ AC1: There should be text inside the expand/collapse button element for TOC subsections.

Screen Recording 2023-02-22 at 6.09.50 PM.mov.gif (884×1 px, 268 KB)

Screenshot 2023-02-22 at 6.08.35 PM.png (1×1 px, 435 KB)

Edtadros subscribed.

Test Result - Prod

Status:
Environment: enwiki
OS: macOS Ventura
Browser: Chrome
Device: MBP
Emulated Device:NA

Test Artifact(s):

QA Steps

❌ AC1: There should be text inside the expand/collapse button element for TOC subsections.
This isn't behaving the same as in beta. Let me know if I'm validating the correct thing.

Screenshot 2023-02-23 at 7.23.51 PM.png (1×1 px, 446 KB)

Untitled.mov.gif (1×1 px, 503 KB)

Seems to be working now I just checked https://en.wikipedia.org/wiki/Mohamed_Salah while logged in @Edtadros Would you please recheck

@Mabualruz is the label only supposed to be there while logged in? That seems to be the case. If so then this can be a pass. Here are some screenshots. Let me know how to proceed.

Logged OutLogged In
Screenshot 2023-02-24 at 4.00.57 PM.png (640×1 px, 293 KB)
Screen Recording 2023-02-24 at 4.01.42 PM.mov.gif (1×1 px, 508 KB)
Screenshot 2023-02-24 at 3.59.25 PM.png (660×1 px, 305 KB)
Screen Recording 2023-02-24 at 4.02.45 PM.mov.gif (1×1 px, 644 KB)

cache os probably to blame here, but i am not 100% sure, since logged in users do not get cached pages, it is the only thing I can think of. So I will wait until tomorrow to be sure cache has refreshed for me on the pages on logged out cases

I can confirm there is no cache for logged in users. You can clear cache for anonymous users by appending ?action=purge to a URL.

I can confirm, as cache auto clears on Mondays that labels are showing, I will be making sure to note the purge action for future use