Skip to content
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

Fix centered legacy button. #23381

Merged
merged 3 commits into from
Jun 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions packages/block-library/src/buttons/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,30 @@
}

.wp-block-buttons.alignright .wp-block-button {
/*rtl:ignore*/
margin-right: 0;
/*rtl:ignore*/
margin-left: $grid-unit-10;

&:first-child {
/*rtl:ignore*/
margin-left: 0;
}
}

.wp-block-buttons.alignleft .wp-block-button {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this since it's the default style if we don't have alignments?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes because the default in RTL settings is right aligned.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But wouldn't the style be flipped in the RTL mode?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, the alignment buttons are the specific exception because the class names are explicitly set.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean we need to wrap these with /*!rtl:begin:ignore*/ ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MAYBE.

Yes. Actually it does. On it.

/*rtl:ignore*/
margin-left: 0;
/*rtl:ignore*/
margin-right: $grid-unit-10;

&:last-child {
/*rtl:ignore*/
margin-right: 0;
}
}

.wp-block-button.aligncenter, // This is to support the legacy Button block.
.wp-block-buttons.aligncenter {
text-align: center;
}