Skip to content

Anchors in links to markdown file doesn't scroll anymore

Summary

Links to markdown file with an anchor in the URL doesn't work anymore.

I believe it's a regression. I have the issue only on gitlab.com. We have a self-managed installation running version 14.8.4-ee.0 where we don't have the issue yet.

On closer inspection, this bug is only present when the :refactor_blob_viewer feature flag is enabled.

Steps to reproduce

(On self-managed installation, Feature.enable(:refactor_blob_viewer))

  1. Go to https://gitlab.com/gitlab-org/gitlab/-/blob/master/README.md
  2. On the left of any title, click on the link icon. The scroll will be adjusted and the url will be updated (eg. https://gitlab.com/gitlab-org/gitlab/-/blob/master/README.md#getting-help)
  3. Refresh the page. It does not scroll to the title.

Example Project

https://gitlab.com/gitlab-org/gitlab/-/blob/master/README.md#getting-help

However, for the README.md page, the default project view works: https://gitlab.com/gitlab-org/gitlab#getting-help

What is the current bug behavior?

It does not scroll to the title in the anchor.

What is the expected correct behavior?

It should scroll to the correct title.

Relevant logs and/or screenshots

Output of checks

This bug happens on GitLab.com

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

Possible fixes

Edited by Thomas Chandelle