fix: Fix button alignment for email templates in Outlook #53950
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The button group generated in email templates is expected to show the two buttons side by side in a single row, but in Outlook both buttons took the full width of the wrapper row and each button was shown in its own row. To solve that the buttons are wrapped in an additional table that shows each button in its own cell, limiting their width and showing them in a single row; this is done conditionally and only applied in Outlook, so it should not affect other clients.
The ghost column technique was got from https://www.emailonacid.com/blog/article/email-development/using-ghost-columns-to-fix-alignment-problems-in-outlook/ Further Outlook quirks can be seen in https://www.emailonacid.com/blog/article/email-development/how-to-code-emails-for-outlook-2016/
Reviewers: while it would be desirable to improve a bit more the look of the button this is tricky due to the limitations of Outlook, so for now the current fix should be merged and if it ends being possible to improve it further it can always be done in a follow-up.
🆘 Help needed
However, please note that I do not have Outlook myself, so this fix is just theoretical and it has not been tested (other than trying to simulate in Firefox the reported behaviour of Outlook and then adding the wrapper table to check the result), so this should be verified (and, maybe, adjusted) by someone with access to Outlook :-) Thanks!🖼️ Screenshots
How to test