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

Limit content width for things aligned left/right #3504

Merged
merged 4 commits into from
Mar 24, 2021
Merged
Show file tree
Hide file tree
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
17 changes: 17 additions & 0 deletions blank-canvas-blocks/assets/ponyfill.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions blank-canvas-blocks/experimental-theme.json
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@
"horizontal": "20px",
"vertical": "20px"
},
"alignment": {
"alignedMaxWidth": "50%"
},
"button": {
"typography": {
"fontWeight": "normal",
Expand Down
20 changes: 20 additions & 0 deletions blank-canvas-blocks/sass/base/_alignment.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,23 @@
margin-right: calc(-1 * var(--wp--custom--margin--horizontal));
}

@include media(mobile) {
// limit size of any element that is aligned left/right
.wp-block[data-align="left"], // This is for the editor
.wp-block[data-align="right"], // This is for the editor
.wp-site-blocks .alignleft,
.wp-site-blocks .alignright {
max-width: var(--wp--custom--alignment--aligned-max-width);
}
}

// When content is aligned left/right (particularly inside of a container) it is floated left/right
// and needs something to ensure that the content follows the block rather than nestling up beside the floated element.
// The issue should be resolved upstream: https://github.com/WordPress/gutenberg/issues/10299
.wp-block-group:after {
clear: both;
content: ".";
display: block;
position: unset;
visibility: hidden;
}