Open fernamp opened 2 years ago
Damn that would be such a nice fix to have if it have 0 side effects ! Great finding !
How does it work with transparent buttons ? You put a 1px solid transparent
on a
tag ?
Can we try to have a compatibility (emailonacid/litmus) test with fixed width button, multi lines button, and button with img inside it ?
We need to be sure it won't break anything else in other desktop clients.
I'll be onto it later this week. I will return to post info as soon as I have some data and tests from EOA and Litmus. Thanks for the testing ideas btw!
This issue has been solved here by Maizzle: https://maizzle.com/docs/examples/buttons
<a
href="https://maizzle.com/"
class="inline-block py-4 px-6 text-sm leading-none font-semibold rounded [text-decoration:none] text-white bg-indigo-500 hover:bg-indigo-600">
<!--[if mso]><i style="letter-spacing: 27px; mso-font-width: -100%; mso-text-raise: 26pt;"> </i><![endif]-->
<span style="mso-text-raise: 13pt;">Read more</span>
<!--[if mso]><i style="letter-spacing: 27px; mso-font-width: -100%;"> </i><![endif]-->
</a>
We don’t want VML inside mj button because it would require to check if the button is wrapped in an element that can produce VML.But for the general use case it’s a great solution.On 13 Nov 2022, at 01:59, robertmylne @.***> wrote: This issue has been solved here by Maizzle: https://maizzle.com/docs/examples/buttons <a href="https://maizzle.com/" class="inline-block py-4 px-6 text-sm leading-none font-semibold rounded [text-decoration:none] text-white bg-indigo-500 hover:bg-indigo-600">
<span style="mso-text-raise: 13pt;">Read more</span>
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you commented.Message ID: @.***>
OK, I did some tests and changes to the mjml-button\src\index.js
file and that solves the clickable area.
border: this.getAttribute('background-color') + ' 1px solid',
before the border-radius declaration, in the "content" area.The colour of the "border" should be coordinated with the colour of the TD's background.
Here the MJML with the test:
and here the resulting HTML:
Results in EOA and Litmus show the button working everywhere.
This is from MSO 2019:
I have to check with my company if I can share the links.
Or contact me directly to share them (I'll try to do it from my side anyway).
I'll check if the Maizzle implementation is usable/implementable in MJML.
Looks good then if you can open a PR about this ? I think it should just handle the case where user wants another border color on this one 👍
Sorry to come back very late about this, but can we test multi line button with this technique ?
The mj-button does not work as expected in MSO PC desktop because it has specific instructions that produce the problem.
To Reproduce Steps to reproduce the behavior:
use the usual:
<mj-button href="www.google.com" border="1px solid red">Unmodified button</mj-button>
The HTML produced is this one:
Expected behavior This HTML:
In MSO,
<a>
is an inline but UNMODIFIABLE element (it can't become a block, nor an inline-block), unless you trick MSO into think that the<a>
is "something" cause it has a border, triggering the use of the display declaration and therefore, the use of the padding (so removing the tool that provides the inner spacing of the button using mso-padding-alt: 0px; is kind of weird (taking into account that adding padding to the<a>
in MSO has no real effect).The previous code make the whole button clickable in MSO.
Screenshots Unmodified MJML button HTML:
Modified MJML button HTML:
Is this something MJML team can take? Or should I make a branch?