diff --git a/lib/__tests__/mail-reading.test.ts b/lib/__tests__/mail-reading.test.ts index 3954363ec..94145ccdf 100644 --- a/lib/__tests__/mail-reading.test.ts +++ b/lib/__tests__/mail-reading.test.ts @@ -120,6 +120,7 @@ describe('mailOverrideCss', () => { expect(css).toContain('font-family:"Lexend", sans-serif!important;font-size:calc(0.875rem * 1.25)!important'); expect(css).toMatch(/body \*:not\([^)]*\)\{font-family:inherit!important;font-size:1em!important[^}]*color:#111111!important;background-color:transparent!important;background-image:none!important/); expect(css).toContain('a[href],a[href] *{color:#1d4ed8!important}'); + expect(css).toContain('a[href]{text-decoration-line:underline!important}'); expect(css).not.toContain('letter-spacing'); }); diff --git a/lib/mail-reading.ts b/lib/mail-reading.ts index b5b103886..a71f4644b 100644 --- a/lib/mail-reading.ts +++ b/lib/mail-reading.ts @@ -206,7 +206,10 @@ export function mailOverrideCss(o: MailOverride): string { `${text}{font-family:inherit!important;font-size:1em!important;line-height:inherit!important;color:${fg}!important;background-color:transparent!important;background-image:none!important;text-shadow:none!important}`, 'h1{font-size:1.6em!important}h2{font-size:1.4em!important}h3{font-size:1.2em!important}h4,h5,h6{font-size:1.05em!important}', o.minPx > 0 ? `small,sub,sup{font-size:max(0.85em,${o.minPx}px)!important}` : 'small,sub,sup{font-size:0.85em!important}', + // Underlined too: with the backgrounds gone, a link drawn as a button + // would otherwise look like plain text. `a[href],a[href] *{color:${link}!important}`, + 'a[href]{text-decoration-line:underline!important}', // Never justified (the text pass catches justify from