mjml icon indicating copy to clipboard operation
mjml copied to clipboard

Fixed the unclickable area in MSO-PC for the buttons

Open fernamp opened this issue 2 years ago • 17 comments

Notes for the previous Issue #359 fixed here, following the discussion at Issue #2565

In getStyles.td:

Removed the mso-padding-alt as inner padding cause is no longer needed when the size of the button is controlled by the padding in the anchor. If I keep the MSO-attribute, the button will be shown as twice the size in MSO-PC.

in getStyles.content:

Removed the mso-padding-alt: 0px cause is nullifying the effect of activating the anchor as a button in MSO-PC. The padding in the anchor is now effectively creating the internal size of the button.

Added border:

1px solid which activates a "bug" in MSO-PC, forcing MSO to read the display attribute of the button (default: inline-block) and thus, changing the behavior of the anchor in MSO to act like a common anchor in all the other readers/browsers.

To avoid non-corresponding colours between the background of the container TD and the border created in the anchor, I added the this.getAttribute('background-color') property to the style, aligning both colours, minimizing the unwilling mismatching.

Results in MSO-PC

OUTLOOK_XV0ASQ3Yp9

Tested in EoA:

msedge_LmhK6iasyn

msedge_vFvHRbUEhY

msedge_GJFkN9eRU4

msedge_dmll9qjS51

msedge_NvHu4RHSal

Tested in Litmus

msedge_y3YeP1cyMR

msedge_yKEEjAEX4a

msedge_yKEEjAEX4a

fernamp avatar Dec 02 '22 13:12 fernamp

Thanks for this PR it might be the greatest improve on button compatibility this far. I'll try to get some time this month to get this tested and merged 🎉

iRyusa avatar Dec 06 '22 15:12 iRyusa

When it'll be merged?

jonybekov avatar Dec 22 '22 19:12 jonybekov

Any updates on this? When it will be merged?

cricketnest avatar Jan 12 '23 06:01 cricketnest

I would also love to see this merged and released! 😸 Happy to help with testing or anything else that needs doing.

manuelmeurer avatar Mar 15 '23 22:03 manuelmeurer

Sorry for the wait I'd like to release in it's own version ! Can you fix the lint issue @fernamp ? Thanks !

iRyusa avatar Apr 05 '23 09:04 iRyusa

Updated. Sorry for the delay. I missed the last message!

fernamp avatar Apr 27 '23 11:04 fernamp

It's totally me here PR is open for wayyy too long. I'm trying to get this merge next week thanks a lot for the update ! <3

iRyusa avatar May 04 '23 09:05 iRyusa

Mmm I will try to fix that again, but is kind of weird that everything works but linter doesn't like the concatenation. Someone can help and say if there is a better way to write that concatenation beside the variable? border: this.getAttribute('background-color') + ' 1px solid',

Should I create a var to get the background color and then concatenate the 1px solid? or what? I'm not a 100% programmer so I'm aware I may be asking or doing something stupid. Help much appreciated.

fernamp avatar May 09 '23 10:05 fernamp

border: `${this.getAttribute('background-color')} 1px solid`,

Should satisfy the linter here 👍

iRyusa avatar May 09 '23 11:05 iRyusa

I'll test it! Thanks!

fernamp avatar May 15 '23 09:05 fernamp

Can this be merged?

hymair avatar Jun 27 '23 05:06 hymair

wen?

ketys-from-meiro avatar Sep 07 '23 11:09 ketys-from-meiro

Can we get this merged??

alexfoxy avatar Oct 10 '23 12:10 alexfoxy

Would be great if this could be merged

timmyrosen avatar Nov 06 '23 13:11 timmyrosen

It's been a while, can someone else just fix the lint issue?

Plonq avatar Jan 16 '24 03:01 Plonq

What is holding this PR from being merged? Is there anything the community can further assist with to push this through? Kindly looking forward to the merge, @iRyusa @fernamp

renchris avatar Feb 09 '24 23:02 renchris

After some testing it look like multiline button behave weird with this tech. Need some more testing on my side to see what's happening :/

On Sat, Feb 10, 2024 at 12:13 AM renchris @.***> wrote:

What is holding this PR from being merged? Is there anything the community can further assist with to push this through? Kindly looking forward to the merge, @iRyusa https://github.com/iRyusa @fernamp https://github.com/fernamp

— Reply to this email directly, view it on GitHub https://github.com/mjmlio/mjml/pull/2591#issuecomment-1936724202, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAELHTPZVQ5PMESBY7AOD3DYS2UP7AVCNFSM6AAAAAASR4STZWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZWG4ZDIMRQGI . You are receiving this because you were mentioned.Message ID: @.***>

iRyusa avatar Feb 09 '24 23:02 iRyusa

This worked for me changing the display: inline-block to display: block as Outlook on macOS and Chrome browser had the button not fully clickable until that change.

MJML

<mj-raw>
  <table border="0" cellpadding="0" cellspacing="0" role="presentation" style="width: 100%; max-width: 600px; margin: 0 auto;">
    <tr>
      <td align="center" bgcolor="#3B71FE" role="presentation" style="border-radius: 25px; cursor: pointer; background-color: #3B71FE;" valign="middle">
        <a href="https://www.google.com" style="display: block; padding: 10px 25px; border-radius: 25px; background-color: #3B71FE; color: #ffffff; font-family: Ubuntu, Helvetica, Arial, sans-serif; font-size: 16px; font-weight: normal; text-decoration: none; line-height: 180%;" target="_blank"> Start Registration </a>
      </td>
    </tr>
  </table>
</mj-raw>

HTML

<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="width: 100%; max-width: 600px; margin: 0 auto;">
  <tr>
    <td align="center" bgcolor="#3B71FE" role="presentation" style="border-radius: 25px; cursor: pointer; background-color: #3B71FE;" valign="middle">
      <a href="https://www.google.com" style="display: block; padding: 10px 25px; border-radius: 25px; background-color: #3B71FE; color: #ffffff; font-family: Ubuntu, Helvetica, Arial, sans-serif; font-size: 16px; font-weight: normal; text-decoration: none; line-height: 180%;" target="_blank"> Start Registration </a>
    </td>
  </tr>
</table>

I used MJML v4.15.2 with the terminal command mjml -r mjml-input-template.mjml -o html-output-template.html instead of the MJML desktop app which just uses MJML v4.12.0

renchris avatar May 31 '24 09:05 renchris