Fix snippet table of contents dropdown stacking

What does this MR do and why?

Fixes the table of contents dropdown in multi-file snippets being obscured by subsequent sticky file headers.

Each snippet file header created the same z-index stacking context. Because a descendant dropdown cannot escape its parent stacking context, increasing only the dropdown's z-index would not fix the overlap. This change raises only the active file header while its table of contents is open, then restores the default stacking level when the dropdown closes or the viewer changes.

Changelog: fixed

References

Closes #604294 (closed)

Screenshots or screen recordings

Before: https://gitlab.com/gitlab-org/gitlab/-/uploads/ba6f046c808dd9d51bb813ecc9817798/snippet-toc-obscured.mov

After: Not available locally because a GDK browser environment was not available. The stacking-state behavior is covered by regression tests.

How to set up and validate locally

  1. Open a multi-file snippet containing Markdown headings.
  2. Open the table of contents on the first file.
  3. Scroll until the next file header reaches the dropdown.
  4. Confirm the dropdown remains above subsequent file headers.
  5. Close the dropdown and confirm the header returns to its default stacking level.

Test coverage

  • spec/frontend/blob/components/blob_header_spec.js
  • spec/frontend/blob/components/table_contents_spec.js

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

Merge request reports

Loading
Loading