mirror of
https://github.com/root-fr/jmap-webmail.git
synced 2026-09-23 16:01:15 +00:00
The previous :has()-based print rules worked in Chromium's headless PDF export but produced a blank page in Firefox. Rather than fight browser-specific differences in @media print with :has(), flex, and visibility on deeply-nested ancestors, clone the email viewer DOM into a dedicated #print-overlay appended directly to document.body before calling window.print(), and add a html.is-printing class. Print CSS now targets a single well-known id (#print-overlay) at the body root: everything else is display:none'd (no :has() needed), the overlay flows naturally on the page, and the subtree is forced to black text on a transparent backdrop with a white root background so dark-mode rendering prints cleanly on paper with Firefox's default "Print background" setting off. afterprint removes the overlay and clears the class, so both successful prints and cancellations clean up.