From d786a2f1c7763348de03a73572b8d4b49c4f1125 Mon Sep 17 00:00:00 2001 From: Rutger Meekers Date: Wed, 14 Oct 2026 13:49:12 +0200 Subject: [PATCH] fix(mails): size the inline preview to its container, not the viewport The preview iframe was 100vw wide and 100vh tall. Inside the view page or the view modal, which are narrower than the window, a centred email lands past the card's right edge, so the Preview tab shows only the email's background and looks empty unless you scroll sideways. The frame now takes the container's width and a fixed share of the viewport's height. --- resources/views/mails/preview.blade.php | 4 ++-- tests/MailRouteSecurityTest.php | 10 ++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/resources/views/mails/preview.blade.php b/resources/views/mails/preview.blade.php index b966354..3d43892 100644 --- a/resources/views/mails/preview.blade.php +++ b/resources/views/mails/preview.blade.php @@ -1,9 +1,9 @@ -
+
diff --git a/tests/MailRouteSecurityTest.php b/tests/MailRouteSecurityTest.php index 649baed..f777f1c 100644 --- a/tests/MailRouteSecurityTest.php +++ b/tests/MailRouteSecurityTest.php @@ -162,3 +162,13 @@ function downloadUrl(Mail $mail, $attachment): string ->toContain('referrerpolicy="no-referrer"') ->not->toContain('src="'); }); + +it('sizes the inline preview to its container rather than the viewport', function () { + $preview = view('mails::mails.preview', ['html' => '

Preview

'])->render(); + + // A viewport-wide frame inside a narrower card puts a centred email past + // the card's right edge, so the preview looks empty. + expect($preview) + ->toContain('width: 100%') + ->not->toContain('100vw'); +});