-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Button component: Fix RTL alignment when containing icon and text #44787
Button component: Fix RTL alignment when containing icon and text #44787
Conversation
👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @jornp! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks good, and it's testing well for me. 🎉 Thanks for the fix @jornp!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
285c398
to
8e3f32d
Compare
@@ -315,7 +315,7 @@ | |||
} | |||
|
|||
&.has-text { | |||
justify-content: left; | |||
justify-content: start; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just leaving this link here for more details and for anyone looking back at this PR:
What's the difference between the alignment values of start, flex-start, and self-start?
Thanks for the review, @chad1008! I've added a changelog entry. 🙂 Since this is my first contribution here, I'm not authorized to merge the PR. Would you be able to merge it, or is there a way for me to do it? Thanks! |
That's correct, you won't be able to merge it! I can do that for you :) (React Native e2e test failures don't seem related to the changes in this PR) |
Congratulations on your first merged pull request, @jornp! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts: https://profiles.wordpress.org/me/profile/edit/ And if you don't have a WordPress.org account, you can create one on this page: https://login.wordpress.org/register Kudos! |
What?
This fixes the RTL alignment inside the Button component for buttons with both an icon and text.
Why?
The
.components-button.has-icon.has-text
style had ajustify-content: left
, because of which the button contents were always left-aligned, even in RTL languages.This effect normally isn't visible because the buttons aren't wide enough. But it became apparent in Calypso: when opening the block editor's sidebar, the "View Posts" button is actually a wider one:
For this button, the problem with the alignment for RTL languages is visible:
How?
This PR changes the
justify-content
fromleft
tostart
, which works for both LTR and RTL languages.Testing Instructions
edit.js
with the following — some extra width has been added to the button to be able to see the effect of the alignment:Screenshots
RTL before & after:
LTR before & after (should be unchanged):