wiki anchors don't work
Summary
Wiki anchor links do not work.
Steps to reproduce
- Create a page long enough to need to scroll to get to a title, with multiple headings and a
[[_TOC_]]
entry - click on some TOC entry that makes the page scroll (that works)
- copy the URL in the URL bar
- open a new tab
- paste the URL
- notice how the page doesn't scroll down to the anchor
Example Project
This link should drop down to the "Colonial Internet" anchor, but doesn't: https://gitlab.com/anarcat/test/-/wikis/long-page-no-anchors#colonial-internet
What is the current bug behavior?
The viewport doesn't scroll down in my web browser. Reproducible in:
- Firefox 91.9.0esr (64-bit) with an empty profile, on Debian 11 bullseye
- Chromium 101.0.4951.41 (Official Build) built on Debian 11.3, running on Debian 11.3 (64-bit)
What is the expected correct behavior?
The viewport should scroll.
Relevant logs and/or screenshots
This is pretty unremarkable for a screenshot, but you asked for one. :)
Output of checks
This bug happens on GitLab.com
Possible fixes
I'm not sure, but it looks like this happens because the wiki page content is dynamically loaded after the actual page load, and then the browser can't find the anchor at load time. There would probably need to be some javascript that scrolls the viewport after the wiki page actually load.
Future iterations
Alternatively, how about getting rid of some javascript here and just render the page correctly without javascript? Right now if I turn off javascript (with uBlock), the page just renders a blank, which is pretty bad behavior. text-based browsers like w3m also fail to render the page, and i suspect crawlers might have trouble too. Follow up issue to address this is #363122.