Page MenuHomePhabricator

Technical: Icon classes should apply to list items in user menu
Closed, ResolvedPublic0 Estimated Story Points

Description

When modifying skin menu definitions, modifying the class usually has the impact of modifying the class of the list item LI. However, in the case of the user menu dropdown this does not appear to the be the case. This prevents us from hiding the menu items at lower resolutions and thus prevents us from making many modifications to padding.

When adding the class to signal a menu item should collapse using the class parameter, like so:
https://github.com/wikimedia/Vector/blob/master/includes/Hooks.php#L157
the class ends up on the anchor tag, instead of the list item resulting in the HTML:

<li id="pt-userpage">
  <a href="/wiki/User:Jdlrobson" class="user-links-collapsible-item mw-ui-icon mw-ui-icon-before mw-ui-icon-wikimedia-userAvatar" dir="auto" title="Your user page [⌃⌥.]" accesskey=".">Jdlrobson</a>
</li>

rather than the HTML:

<li id="pt-userpage" class="user-links-collapsible-item mw-ui-icon mw-ui-icon-before mw-ui-icon-wikimedia-userAvatar">
  <a href="/wiki/User:Jdlrobson" dir="auto" title="Your user page [⌃⌥.]" accesskey=".">Jdlrobson</a>
</li>

Presumably, this is an inherited behaviour from the old system.

Luckily, since the new menu was only added in 1.37 (which hasn't been released and is therefore not stable) we can retain the old behaviour for skins using the flattened list containing all items, and fix the behaviour of the new menu by modification.

QA steps

Screen Shot 2021-07-01 at 8.53.21 AM.png (148×526 px, 28 KB)

Screen Shot 2021-07-01 at 8.57.44 AM.png (148×986 px, 38 KB)

QA Results - Beta

ACStatusDetails
1T285960#7224672

Event Timeline

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

[mediawiki/core@master] Make user-menu list items produce HTML consistent with other menus

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

Change 702475 merged by jenkins-bot:

[mediawiki/core@master] Make user-menu list items produce HTML consistent with other menus

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

Change 703840 had a related patch set uploaded (by Kosta Harlan; author: Kosta Harlan):

[mediawiki/extensions/GrowthExperiments@master] HomepageHooks: Unset link-class from user page URL

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

Change 703840 merged by jenkins-bot:

[mediawiki/extensions/GrowthExperiments@master] HomepageHooks: Unset link-class from user page URL

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

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

[mediawiki/skins/Vector@master] Fix collapsible item behaviour

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

Change 704435 merged by jenkins-bot:

[mediawiki/skins/Vector@master] Fix collapsible item behaviour

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

Edtadros added a subscriber: Edtadros.

Test Result - Beta

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

Test Artifact(s):

QA Steps

Log in as a new user or a user without a sandbox
In https://en.wikipedia.beta.wmflabs.org/wiki/Albert_Einstein?useskinversion=1 log in and inspect the HTML of the sandbox menu. The class "new" should be on the anchor tag and the link should be red

Screen Shot 2021-07-20 at 6.57.48 AM.png (1×976 px, 518 KB)

Use skin version 2, in https://en.wikipedia.beta.wmflabs.org/wiki/Albert_Einstein?useskinversion=2 log in and inspect the HTML of the sandbox menu. The class "new" should be on the anchor tag and should not be red. The classes mw-ui-icon mw-ui-icon-before mw-ui-icon-wikimedia-markup should be on the list item
Screen Shot 2021-07-20 at 7.27.44 AM.png (1×982 px, 510 KB)