Closed Bug 1736244 Opened 3 years ago Closed 3 years ago

HTML message content rendering affected/hidden by messageBody.css styles: Rename our .main-header class to .moz-main-header, use custom attribute, or encapsulate

Categories

(Thunderbird :: Message Reader UI, defect, P2)

Thunderbird 91
All
Unspecified

Tracking

(thunderbird_esr91 fixed)

RESOLVED FIXED
95 Branch
Tracking Status
thunderbird_esr91 --- fixed

People

(Reporter: veremia, Assigned: darktrojan)

References

(Regression)

Details

(Keywords: regression)

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:93.0) Gecko/20100101 Firefox/93.0

Steps to reproduce:

I receive a newsletter as an HTML-formatted message with inline CSS styles, particularly some elements have the .main-header CSS class.

Actual results:

All HMTL elements bearing the CSS class .main-header are not rendered because Thunderbird's messageBody.css stylesheet sets display: none; for this class (it uses this class for hiding the message header).

Expected results:

All HTML content inside a message should be rendered according to the stylesheets defined in that message, not subject to Thunderbird's UI stylesheets.

This was not a problem until a recent update.

Thanks veremia for analysing and reporting this!
Confirming exactly as described: Message reader hides random message content if it has .main-header class.
91.2.0 (64-bit) & 95.0a1 (2021-10-13) (64-bit), Win10.

Regressed by bug 1715726 where the .main-header class was introduced.

  • Geoff, can you fix this by renaming .main-header class to something less generic (hence less likely to be used in user HTML content) like .moz-main-header? That would significantly reduce the likelihood of interference with user content.
  • OR maybe we should use a custom attribute for this, similar to <a moz-do-not-send="true" href="...">linktext</a>? That might reduce the likelihood for leaking (this bug) even more.
  • How hard would it be to totally encapsulate user content, so that our style sheets can never leak into user content?

Ideally, we should prepend moz- to all of our internal classes (as we used to do: .moz-attached-image-container, .moz-vcard-table etc.) to make them more unique, less error-prone and more easy to recognize.
.print-only looks like another candidate which is generic enough to fail, and I'm not sure if that's working because it's under @media screen, and should probably be a plain style (without class name) under @media print which was recently removed.

Classes which should have moz- prepended for consistency:

  • .print-only
  • .header-part1/2/3
  • .headerdisplayname
  • .mimeAttachment*

Remember that every OS has its own messageBody.css (is that still needed?), so currently there's at least 3 files to touch:
https://searchfox.org/comm-central/search?q=&path=messageBody.css

Severity: -- → S2
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(geoff)
Keywords: regression
Priority: -- → P2
Regressed by: 1715726
Hardware: Unspecified → All
Summary: HTML content rendering affected by messageBody.css styles → HTML message content rendering affected/hidden by messageBody.css styles: Rename our .main-header class to .moz-main-header, use custom attribute, or encapsulate

Anje, Wayne, Walt, for support and bug triage: Random message content in message reader might get hidden if it happens to have class="... main-header ...", which is used by Thunderbird to hide stuff.

Assignee: nobody → geoff
Flags: needinfo?(geoff)

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/c7b41831845d
Add a moz- prefix to classes used in messageBody.css. r=mkmelin

Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 95 Branch

Awesome, thanks Geoff for fixing this thoroughly!

Comment on attachment 9246963 [details]
Bug 1736244 - Add a moz- prefix to classes used in messageBody.css. r=mkmelin

[Approval Request Comment]
Regression caused by (bug #): bug 1715726
User impact if declined: potential for some parts of mail to be hidden by CSS
Testing completed (on c-c, etc.): in 95
Risk to taking this patch (and alternatives if risky): low

Attachment #9246963 - Flags: approval-comm-esr91?

Comment on attachment 9246963 [details]
Bug 1736244 - Add a moz- prefix to classes used in messageBody.css. r=mkmelin

[Triage Comment]
Approved for ers91

Attachment #9246963 - Flags: approval-comm-esr91? → approval-comm-esr91+

(I haven't checked code-wise if this is possible) Do we know that this regression fix doesn't regress Bug 1721232 ? [macOS+Windows] With Display Attachments Inline, attached email message shows no message headers in inline preview

Do we know that this regression fix doesn't regress Bug 1721232 ? [

Well, I did remember to change all three stylesheets this time.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: