Add "Open PDF in new window" button to Blob header with tests
-
Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA. As a benefit of being a GitLab Community Contributor, you receive complimentary access to GitLab Duo.
What does this MR do and why?
- Adds a new “Open PDF in new window” button to the Blob header for PDF files in the GitLab UI.
- The button only appears for PDF files and opens them in a new browser tab/window.
- Adds unit tests to verify that:
- The button is rendered for PDF files.
- The button URL correctly includes
inline=true
.
References
Screenshots or screen recordings
simplescreenrecorder-2025-10-15_10.47.55.mp4
How to set up and validate locally
Unit tests
- Run only the specific test file you modified:
yarn jest spec/frontend/blob/components/blob_header_default_actions_spec.js
- Check that all tests pass.
Manual testing
- Navigate in your browser to a repo with a PDF file:
- Check that the “Open PDF in new window” button appears and works.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Edited by Nourhan Hasan