Page MenuHomePhabricator

The `#jump-to-nav` div will be removed in Vector - gadgets will be impacted without change
Closed, ResolvedPublic

Description

Up to 320 user scripts [1] reference the jump-to-nav element to insert UI elements. This element will be removed within the next few weeks and those scripts may break or misbehave without any changes.

Without change this is likely to impact the display of UI elements in code such as:

 $node.insertAfter('#jump-to-nav');
document.getElementById('jump-to-nav').nextSibling

We recommend using the #siteSub or #mw-content-text elements as potential replacements.

Potentially impacted scripts

[1] https://global-search.toolforge.org/?q=jump-to-nav&regex=1&namespaces=&title=.*js

Event Timeline

Jdlrobson updated the task description. (Show Details)

Hi @Jdlrobson If I understand correctly, the wording in the user-notice should be something like:

Some gadgets and user-scripts use the HTML div #jump-to-nav. This div will be removed soon. Maintainers should replace these uses with either #siteSub or #mw-content-text. A list of affected scripts is at the top of phab:T265373.

If that is inaccurate/imperfect, then Please provide a correct version.
I will add it to TechNews tomorrow (Friday) morning (PST) before this issue is frozen for translation, for delivery on Monday.

I remember that [[#jump-to-nav]] in the past was also used as an anchor link sometimes instead of [[#top]]. Might be another impact to look out for.

Do the alternate divs exist in other skins, or will scripts that aim to work across multiple skins need to make an existence check? If the latter, can you provide an example code snippet to aid maintainers?

This element was never part of a standard skin spec so the HTML may or may not be in other skins. Right now this has only been removed in Vector. Other skins should not be impacted.

I'd recommend always doing an existence check for any gadget as other gadgets can alter the look and feel of the skin.

Does that answer your question?

https://gerrit.wikimedia.org/r/c/mediawiki/skins/Vector/+/633207 was merged in October 2020; no reason to keep this ticket open