Commit 79ec7da
Fixed: Order view page CSS leak from embedded email communication content (OFBIZ-13390) (#1214)
Backport of [#1213](#1213)
to release24.09.
## Summary
When a `CommunicationEvent` exists on an order, the `OrderConversations`
screen dumps the stored email HTML (a full `<!DOCTYPE html>` document,
with its own `<style>` block containing a global CSS reset) directly
inline into the order view page. Browsers parse that `<style>` at
document scope — not div scope — so the email's reset cascades into the
parent page and breaks the order layout: tables lose padding, the body
background changes, `.screenlet` styling is overridden, etc.
## Fix
Render the email body inside an `<iframe>` so its CSS lives in its own
document context and cannot leak. The stored content is
HTML-entity-encoded, so it's decoded client-side via a `<textarea>`
before being assigned to `srcdoc`.
One file changed:
`applications/party/template/party/DisplayCommunicationContent.ftl`.
## Test plan
- [ ] Open an order that has at least one communication event (e.g. send
an order confirmation email, then revisit the order view).
- [ ] Expand the "All Communication Events" section.
- [ ] Verify the email body renders inside a bordered iframe with the
email's own styling (heading, cards, items table).
- [ ] Verify the parent order view page styling is unaffected — tables,
padding, screenlets all render normally.
- [ ] Verify the iframe auto-resizes to fit the email content (`onload`
handler).
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent db54a10 commit 79ec7da
1 file changed
Lines changed: 19 additions & 4 deletions
Lines changed: 19 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
0 commit comments