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
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
- Open a multi-file snippet containing Markdown headings.
- Open the table of contents on the first file.
- Scroll until the next file header reaches the dropdown.
- Confirm the dropdown remains above subsequent file headers.
- Close the dropdown and confirm the header returns to its default stacking level.
Test coverage
spec/frontend/blob/components/blob_header_spec.jsspec/frontend/blob/components/table_contents_spec.js
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist.
Merge request reports
Loading