[Fix] Make sure Latest Posts alignment class behaviour#8847
[Fix] Make sure Latest Posts alignment class behaviour#8847aduth merged 2 commits intoWordPress:masterfrom nfmohit:update/latest-posts-block/7911
Conversation
…ignment is selected
|
Thinking about the original issue, if it was really intentional for center to be default, and how we'd support "unsetting" that value, I think if that was something we'd want to support, we could do so by setting the alignment to This, of course, is a non-issue after these changes. |
|
Totally unrelated to the changes here, but the alignment implementation doesn't work so well on lots of themes, where |
|
Failing test was legitimate. |
|
Thank you so much for the correction and merge @aduth ❤️ |
|
@aduth Any idea why we don't use That would, of course, require us to wrap the list up with a |
|
@nfmohit-wpmudev A few things:
|
|
Got it, thank you so much for the explanation @aduth ❤️ |

Description
This PR closes #7911 which reports the incorrect behavior of the alignment classes in the Latest Posts block, where it applies alignment classes even if no alignment was selected. It also gets rids of the behavior where the center alignment is selected by default.
How has this been tested?
This PR has been tested by going through the following steps:
This was tested in WP 4.9.8, Gutenberg 3.5.0, Apache server with PHP 7.2.0 and MySQL 5.6.34. According to initial tests, the code doesn’t seem to affect any other areas.
Screenshots
Types of changes
This PR introduces a conditional before applying the alignment classes to make sure an alignment is selected in the first place. It also removes the
defaultproperty from thealignattribute, so that the center alignment isn't selected and applied by default.Checklist: