Skip to content

Conversation

@j-ethan-plunk
Copy link

Description

Fixes the flyout menu overlapping documentation content when printing or generating PDFs.

Problem

The <readthedocs-flyout> Shadow DOM component remains visible when printing documentation or saving as PDF, causing it to overlap and obscure the actual documentation content. This affects thousands of documentation sites hosted on Read the Docs.

Solution

Added @media print CSS rule inside the Shadow DOM styles (src/flyout.css) to hide the flyout element when printing:

Why This Approach

  • Shadow DOM Compatible: Uses :host selector which correctly targets the Shadow DOM root
  • Print-Specific: Only affects print/PDF output, not normal viewing
  • Clean: No JavaScript required, pure CSS solution
  • Comprehensive: Hides the entire component including all child elements

Testing

  • Tested with dev server print preview
  • Verified PDF generation via browser
  • Confirmed no impact on normal page viewing
  • All tests pass (106/106)

Screenshots

Before:
Screenshot_20251122_191510

After:
Screenshot_20251122_191056

Add @media print rule to flyout Shadow DOM CSS to prevent
the version selector from appearing in printed documentation
or PDF exports.

The flyout overlaps content when printing, making documentation
hard to read. This fix uses @media print with :host selector
to hide the entire Shadow DOM component during print.
@j-ethan-plunk j-ethan-plunk requested review from a team and humitos as code owners November 23, 2025 01:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant