Page MenuHomePhabricator

TOC links do not work if next to code block
Open, Needs TriagePublic

Description

Links in the TOC are not clickable if there is a code block next to them. The div containing the code block stretches across the whole content area, but it doesn't cover the TOC visually. Other elements (p, h3...) also do this; not sure what is different with the div.

Steps to reproduce:

  1. Go to https://www.mediawiki.org/w/index.php?title=Manual:Coding_conventions/PHP&oldid=4329191
  2. Click on one of the links that are on the same level as the first code box. The first is probably 1.7, but could vary depending on window width.

Actual result:
Nothing happens.

Expected result:
Link does what it should.

Additional information:
Firefox 84.0.2, Ubuntu 18.04.5
Both with old and new skin version.

Event Timeline

The same behavior can be examined with the Infobox on https://en.wikipedia.org/wiki/Vala_(programming_language) with a viewport wide enough to bring a code block high enough on the screen.

OS: Windows 10 Version 20H2
Browser: Microsoft Edge (Chromium-based) Version 88.0.705.56 (Official build) (64-bit)

Removing the code block's parent <div> and adding its attributes to the child <pre> tag seems to resolve the issue, but being generally unfamiliar with MediaWiki I am not sure how feasible this is.

If the parent <div> is necessary, it also seems that setting the display: contents; property also achieves the same thing as by design this treats the <div> element as if it doesn't exist visually while allowing its children to inherit its properties. This seems to be the desired option in this scenario if removing the <div> isn't feasible.