Skip to content

fix(mails): size the inline preview to its container, not the viewport - #89

Open
rmeekers wants to merge 1 commit into
backstagephp:5.xfrom
rmeekers:fix/preview-fits-its-container
Open

rmeekers wants to merge 1 commit into
backstagephp:5.xfrom
rmeekers:fix/preview-fits-its-container

Conversation

@rmeekers

Copy link
Copy Markdown

Problem

The Preview tab on a mail renders its iframe at width: 100vw; height: 100vh. The view page and the view modal are narrower than the window, so the frame overflows its card, and an email whose content is centred (as most transactional templates are) lands to the right of the visible area. The tab then shows only the email's background colour and looks empty; the content is only reachable by scrolling the card sideways, which nothing hints at.

Change

  • The frame takes width: 100% of its container and its wrapper a height of 75vh, both inline so they do not depend on the host panel compiling the package's Tailwind classes.
  • The sandbox, referrerpolicy and srcdoc escaping are unchanged.
  • A test that the preview no longer sizes itself to the viewport.

Before and after, the same email in a 640px card on a 1920px window: before shows the grey background only, after shows the email.

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.
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