Job log deep linking is broken

Summary

Deep linking to specific lines in job logs does not work as expected

Steps to reproduce

  1. Open a CI/CD job long that spans multiple screens, e.g. https://gitlab.com/gitlab-org/gitlab/-/jobs/4116540397
  2. Scroll down the log and click on a line number link, e.g. 400
  3. Copy the URL from the browser address bar; this will contain a fragment identifier for the line, e.g. https://gitlab.com/gitlab-org/gitlab/-/jobs/4116540397#L400
  4. Open a new browser tab and navigate to the copied URL

Example Project

What is the current bug behavior?

  • After step 2 the job log is scrolled, and line two below the line that was clicked is the first visible line, e.g. line 402 is displayed for the above examples
  • After step 4 the job log in the new tab is opened scrolled to the bottom of the log

What is the expected correct behavior?

  • After step 2 the job log is scrolled, and the line that was clicked is the first visible line, e.g. line 400 should be displayed for the above examples
  • After step 4 the job log is scrolled to the line identified in the fragment identifier of the link

Relevant logs and/or screenshots

Output of checks

This bug happens on GitLab.com /label reproduced 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