Page MenuHomePhabricator

[October] Update to user styles and scripts required: .menu, .vectorTabs and .vectorMenu, .menu and .vectorMenuCheckbox no longer supported
Closed, ResolvedPublic

Description

The HTML structure of menus is changing and this will impact various gadgets. For example, dropdowns in Vector e.g. more menu currently apply a .menu class. This will soon no longer the case. After the change has applied, a new class .mw-portlet will be available. With time this class will be used across all skins, making HTML more predictable and maintainable and thus making gadget development easier.

ACTION REQUIRED: Please review the following user scripts to use nav ul instead, or .vector-menu ul / .vector-menu / .vector-menu-tabs if targetting Vector only.

Examples of selectors that will no longer work:

#p-cactions > .menu > ul
div.vectorMenu
.vectorTabs

Example

Before HTML:

<nav id="p-cactions" class="vector-menu-empty vector-menu vector-menu-dropdown vectorMenu" aria-labelledby="p-cactions-label" role="navigation" style="margin-right: initial;">
	<input type="checkbox" class="vector-menu-checkbox vectorMenuCheckbox" aria-labelledby="p-cactions-label">
	<h3 id="p-cactions-label">
		<span>More</span>
	</h3>
	<!-- Please do not use the .body class, it is deprecated. -->
	<div class="body vector-menu-content">
		<!-- Please do not use the .menu class, it is deprecated. -->
		<ul class="menu vector-menu-content-list"><li id="ca-purge"><a href="/w/index.php?title=Main_Page&amp;action=purge" title="Purge the server cache of this page [⌃⌥*]" accesskey="*">Purge</a></li></ul>
		
	</div>
</nav>

After HTML:

<nav id="p-cactions" class="vector-menu-empty vector-menu vector-menu-dropdown" aria-labelledby="p-cactions-label" role="navigation" style="margin-right: initial;">
	<input type="checkbox" class="vector-menu-checkbox" aria-labelledby="p-cactions-label">
	<h3 id="p-cactions-label">
		<span>More</span>
	</h3>
	<!-- Please do not use the .body class, it is deprecated. -->
	<div class="vector-menu-content">
		<!-- Please do not use the .menu class, it is deprecated. -->
		<ul class="vector-menu-content-list"><li id="ca-purge"><a href="/w/index.php?title=Main_Page&amp;action=purge" title="Purge the server cache of this page [⌃⌥*]" accesskey="*">Purge</a></li></ul>
		
	</div>
</nav>

Compatibility script

JS Gadgets can prepend the following to their code to maintain compatibility as they migrate:

$('.vector-menu-tabs').addClass( 'vectorTabs' );
$('.vector-menu-content').addClass('body');
$('.vector-menu-checkbox').addClass('vectorMenuCheckbox');
$('.vector-menu-dropdown').addClass('vectorMenu');
$('.vector-menu-content-list').addClass('menu');

Scripts should update their selectors

Impacted

Only Vector will be impacted by this change.

Suspected to impact < 3000 pages
https://global-search.toolforge.org/?q=(\.vectorMenu|\.vectorTabs)&regex=1&namespaces=&title=.*/.*(js|css)

Event Timeline

Change 624908 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/skins/Vector@master] Drop support for vectorMenu, vectorTabs and menu selectors

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

Od1n updated the task description. (Show Details)

Why is it only about user scripts? How media wiki script are going to be updated?

@Uziel302: Please provide a specific, existing example for "MediaWiki scripts" which need(s) to be updated. Thanks.

From the description, it is not that clear on how the scripts should be fixed.
Is it simply the following replacements?

.menu -> nav ul
.vectorTabs -> .vector-menu-tabs
.vectorMenu -> .vector-menu

(By the way, I am not sure how we should fix https://ja.wikipedia.org/wiki/User:Hiroakikawa/_vector.css)

From the description, it is not that clear on how the scripts should be fixed.
Is it simply the following replacements?

.menu -> nav ul
.vectorTabs -> .vector-menu-tabs
.vectorMenu -> .vector-menu

(By the way, I am not sure how we should fix https://ja.wikipedia.org/wiki/User:Hiroakikawa/_vector.css)

Not exactly. If your script is for Vector only and lives in vector.css/js then using .vector-menu and .vector-menu-tabs is fine, but if you can it's better to use tag based selectors or ID selectors e.g. #p-personal or nav > div

In your example I think #right-navigation div.vectorTabs ul > #right-navigation nav ul should suffice.

Jdlrobson renamed this task from Update to user styles and scripts required: .menu, .vectorTabs and .vectorMenu no longer supported to [October] Update to user styles and scripts required: .menu, .vectorTabs and .vectorMenu, .menu and .vectorMenuCheckbox no longer supported.Sep 14 2020, 8:53 PM
Jdlrobson updated the task description. (Show Details)

Change 615322 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/skins/Vector@master] Use newly available Skin::getPortletData method

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

Change 624908 abandoned by Jdlrobson:
[mediawiki/skins/Vector@master] Drop support for vectorMenu, vectorTabs and menu selectors

Reason:
Merged into https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/ /615322 which also provides the generic and new standard mw-portlet class.

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

Change 629487 had a related patch set uploaded (by Jdlrobson; owner: Jdlrobson):
[mediawiki/skins/Vector@master] WIP: Drop unsupported skin classes

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

Change 629487 merged by jenkins-bot:
[mediawiki/skins/Vector@master] Drop unsupported skin CSS classes

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

Change 638111 had a related patch set uploaded (by Thiemo Kreuz (WMDE); owner: Thiemo Kreuz (WMDE)):
[mediawiki/extensions/CollapsibleVector@master] Replace deprecated .body with .vector-menu-content

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

Change 638111 merged by jenkins-bot:
[mediawiki/extensions/CollapsibleVector@master] Replace deprecated .body with .vector-menu-content

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