Highlight first file on initial load in Rapid Diffs

What does this MR do and why?

On first load, legacy /diffs makes the first file current, so the file browser highlights it. Rapid Diffs highlighted nothing until the user selected a file.

After the file browser loads in multi-file mode, the first file in the browser becomes current. It is skipped when a file is already current, or when the page was opened for a specific file or discussion (linked file, file or line fragment, or #note_ fragment), so those targets keep their highlight.

Closes #636757

Screenshots or screen recordings

Recorded in GDK on this MR's branch alone. The URL bar and captions are drawn in the page because the recording is headless; each step is also asserted against the DOM.

First load of the Changes tab:

How to set up and validate locally

  1. Open a merge request with several changed files on the Changes tab, with Rapid Diffs enabled.
  2. The first file in the file browser is highlighted without any interaction. Repeat with the compact drawer at a narrow width.
  3. Open a link to a discussion on another file. That file is highlighted instead of the first one.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

Edited by Thomas Randolph

Merge request reports

Loading
Loading