mjml icon indicating copy to clipboard operation
mjml copied to clipboard

If preview text exists don't display body text as preview

Open IanEdington opened this issue 3 years ago • 8 comments

closes #1829

We ran into an issue were preview text from the body of the email was being displayed after the preview text. We found this article about how to prevent it and it's been working well for a couple months now.

This is based off this litmus article: https://www.litmus.com/blog/the-little-known-preview-text-hack-you-may-want-to-use-in-every-email/

Also thanks to @j56xie for her work finding this.

Example of the errors this fixes: 110679311-532d5980-81a5-11eb-9d2c-2b4911c240e0

IanEdington avatar May 22 '21 19:05 IanEdington

Will close #1829

Thanks for this PR @IanEdington ! Can you gate this behavior behind an attribute instead of modifying the default behavior ?

iRyusa avatar May 24 '21 10:05 iRyusa

Cool thanks for the context. It seems like the kind of thing you would want on by default so new emails don't run into this weird behaviour. Would it make sense to include it as a breaking change in 4.9?

Are you thinking something like:

<Preview hideBody>

IanEdington avatar May 24 '21 12:05 IanEdington

I know that some local clients doesn't handle those chars properly and display them as plain text that's mostly why I see this as an "opt-in" feature. Name looks good to me 👍

iRyusa avatar May 24 '21 12:05 iRyusa

@iRyusa What do the clients that don't support the ZWNJ display instead of it?

Incidentally I've used this hack extensively but with the Combining Grapheme Joiner &#847; ( Wikipedia ref, Unicode ref ) instead of the ZWNJ and haven't seen any issues, though I'm sure I'm missing some lesser-used clients out there. But perhaps worth testing as an alternative? This writeup (undated though) says the CGJ works on mail.ru where the ZWNJ doesn't.

rootwork avatar May 26 '21 21:05 rootwork

They display directly the ‌ as a string in the preview text. It might be related to the text-version as mentioned in goodemailcode. But I think it behave like that on some french webmail too with no text-version sent.

On Wed, May 26, 2021 at 11:13 PM Ivan Boothe @.***> wrote:

@iRyusa https://github.com/iRyusa What do the clients that don't support the ZWNJ display instead of it?

Incidentally I've used this hack extensively but with the Combining Grapheme Joiner ͏ ( Wikipedia ref https://en.wikipedia.org/wiki/Combining_Grapheme_Joiner, Unicode ref https://www.compart.com/en/unicode/U+034F ) instead of the ZWNJ and haven't seen any issues, though I'm sure I'm missing some lesser-used clients out there. But perhaps worth testing as an alternative? This writeup https://www.goodemailcode.com/email-code/preheader (undated though) says the CGJ works on mail.ru where the ZWNJ doesn't.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mjmlio/mjml/pull/2263#issuecomment-849122742, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAELHTNAF7JFJLLBVQ7GXWTTPVQAZANCNFSM45K5NIHQ .

iRyusa avatar May 26 '21 21:05 iRyusa

@IanEdington thank you for putting it up, we encountered the same issue as well. @iRyusa and is there a plan to merge this to master?

renjiezhu2 avatar Feb 17 '22 18:02 renjiezhu2

There are a few issues with this PR. It only gives a small gap between the content. The more characters the more of a gap it provides. Because screens are getting wider it's theoretically not possible to put enough characters to always hide the other content.

From my perspective this needs someone to run a subject line test on litmus or something similar to understand how many characters are needed to provide a good enough gap.

I'm not going to get to this in the next few months. @renjiezhu2 feel free to take over this PR

IanEdington avatar Feb 20 '22 17:02 IanEdington

I can conform that &#847; &#847; &#847; &#847; &#847; &#847; &#847; &#847; works well across pretty much all email clients.

@IanEdington Screens are getting wide but people are doing more with the space and using all of the available 3440px to display Chrome (Gmail) or Outlook.

People that don't scale their 4K monitors deserve to see body content after the gap!

stinhambo avatar Mar 23 '22 10:03 stinhambo

Hey all, I'm going to close this for now since I won't be working on it. I'd be happy for someone else to take over this work in another PR :D

IanEdington avatar Apr 07 '23 19:04 IanEdington

Is there any solution now to having the text replace instead of prefix the body text in email preview text?

renchris avatar Jun 04 '23 09:06 renchris