Page MenuHomePhabricator

Remove links in titles
Closed, ResolvedPublic

Description

For modules, classes, and namespaces with ancestors, page title h1 headings include links to the pages for those ancestors. Now that we have breadcrumbs to make this navigation more obvious, these links are redundant and create noise for screenreaders.

For example, on https://doc.wikimedia.org/mediawiki-core/master/js/mw.ForeignStructuredUpload.BookletLayout.html, both "mw" and "ForeignStructuredUpload" are links in the h1.

To do: Remove links in page titles

Event Timeline

apaskulin triaged this task as Medium priority.Mar 28 2024, 5:24 PM
apaskulin moved this task from Backlog to Confirmed Problem on the JSDoc WMF theme board.

In our theme's publish.js, a helper function from JSDoc,getAncestorLinks()[1], is used to generate the link markup for the title elements. Note that publish.js's getAncestorLinks() returns helper.getAncestorLinks(), which returns an array of link markup for each title section.

We'll need to either:

  • Call JSDoc's getAncestors() instead, then do something similar to what JSDoc's getAncestorLinks() function does to create the link text, and return an array of that instead of links
  • Keep calling getAncestorLinks(), but then strip the link markup

The first option is much cleaner IMO, but will take a bit of digging in the JSDoc source code to get right.

[1] https://github.com/jsdoc/jsdoc/blob/main/packages/jsdoc-template-legacy/lib/templateHelper.js#L764

I suggest a modified version of Anne's first option: call getAncestors() to get the information about the ancestors and format that the way we want for the header (we should be able to use similar code to what getAncestorLinks() uses to build the link text); and then also call getAncestorLinks() separately, to get the links we need for the breadcrumbs.

Actually never mind, once we've done what I describe there is so little left to do to turn these things into links that we might as well do it ourselves.

Change #1015125 had a related patch set uploaded (by Alex Paskulin; author: Alex Paskulin):

[jsdoc/wmf-theme@master] layout: Remove links from titles in favor of breadcrumbs

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

Change #1015125 merged by jenkins-bot:

[jsdoc/wmf-theme@master] layout: Remove links from titles in favor of breadcrumbs

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

Released as part of v1.0.0