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

Columns block: reinstate tablet 2 col stacking #41123

Closed
wants to merge 6 commits into from

Conversation

ramonjd
Copy link
Member

@ramonjd ramonjd commented May 18, 2022

Related to #40952

What?

This is an experiment to reinstate the tablet breakpoint CSS for the columns block from #37436 which forces two columns rather than a total stack.

Why?

We removed the style as part of #37436 , favouring to stack all column blocks below the desktop breakpoint, however it caused a visual regression.

How?

  1. Reinstating the flex-basis rule, ensuring we offset any current block gap values.
  2. Restricting this behaviour to a new block style "Tablet View" (name debatable)

Screen Shot 2022-05-31 at 10 47 03 am

Testing Instructions

Check in classic and block themes that the columns please!

Insert a columns block with more than 1 column. Ensure that 'stack on mobile' is turned on to allow stacking.

Screen Shot 2022-05-18 at 12 06 36 pm

With the "Tablet View" applied to the columns block, and between 600px and 781px (the "tablet" view) the columns should stack 2 per row, with any trailing columns stretching the full width.

Turn off 'stack on mobile' and check that the columns no longer stack.

The editor and frontend should behave similarly.

Caveat: adding a custom blockGap value that is greater than var(--wp--style--block-gap, 2em) to the columns block will trigger stacking since the spacing is now too great for a 2 per row stacking.

Test block code
<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"style":{"color":{"background":"#eaed48"}}} -->
<div class="wp-block-column has-background" style="background-color:#eaed48"><!-- wp:paragraph -->
<p>Column</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->

<!-- wp:column {"style":{"color":{"background":"#eaed48"}}} -->
<div class="wp-block-column has-background" style="background-color:#eaed48"><!-- wp:paragraph -->
<p>Column</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:columns {"style":{"spacing":{"blockGap":"185px"}}} -->
<div class="wp-block-columns"><!-- wp:column {"style":{"color":{"background":"#ecffae"}}} -->
<div class="wp-block-column has-background" style="background-color:#ecffae"><!-- wp:group -->
<div class="wp-block-group"><!-- wp:paragraph -->
<p>A paragraph inside a Group block inside a Column.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>A paragraph inside a Group block inside a Column.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>A paragraph inside a Group block inside a Column.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>A paragraph inside a Group block inside a Column.</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->

<!-- wp:social-links {"style":{"spacing":{"blockGap":{"top":"68px","left":"68px"}}}} -->
<ul class="wp-block-social-links"><!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /-->

<!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /-->

<!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /-->

<!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /-->

<!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /-->

<!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /-->

<!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /-->

<!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /-->

<!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /-->

<!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /-->

<!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /-->

<!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /-->

<!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /--></ul>
<!-- /wp:social-links --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"style":{"color":{"background":"#ffccd8"}}} -->
<div class="wp-block-column has-background" style="background-color:#ffccd8"><!-- wp:paragraph -->
<p>Column</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->

<!-- wp:column {"style":{"color":{"background":"#ffccd8"}}} -->
<div class="wp-block-column has-background" style="background-color:#ffccd8"><!-- wp:paragraph -->
<p>Column</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->

<!-- wp:column {"style":{"color":{"background":"#ffccd8"}}} -->
<div class="wp-block-column has-background" style="background-color:#ffccd8"><!-- wp:paragraph -->
<p>Column</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:columns {"style":{"spacing":{"blockGap":"81px"}}} -->
<div class="wp-block-columns"><!-- wp:column {"style":{"color":{"background":"#b3002a"},"spacing":{"blockGap":"89px"}}} -->
<div class="wp-block-column has-background" style="background-color:#b3002a"><!-- wp:paragraph -->
<p>Column</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->

<!-- wp:column {"style":{"color":{"background":"#b3002a"}}} -->
<div class="wp-block-column has-background" style="background-color:#b3002a"><!-- wp:paragraph -->
<p>Column</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->

<!-- wp:column {"style":{"color":{"background":"#b3002a"}}} -->
<div class="wp-block-column has-background" style="background-color:#b3002a"><!-- wp:paragraph -->
<p>Column</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->

<!-- wp:column {"style":{"color":{"background":"#b3002a"}}} -->
<div class="wp-block-column has-background" style="background-color:#b3002a"><!-- wp:paragraph -->
<p>Column</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->

<!-- wp:column {"style":{"color":{"background":"#b3002a"}}} -->
<div class="wp-block-column has-background" style="background-color:#b3002a"><!-- wp:paragraph -->
<p>Column</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

Screenshots or screencast

2022-05-18 10 51 44

@ramonjd ramonjd self-assigned this May 18, 2022
@ramonjd ramonjd added [Type] Bug An existing feature does not function as intended [Block] Columns Affects the Columns Block labels May 18, 2022
@ramonjd ramonjd marked this pull request as ready for review May 18, 2022 02:16
@ramonjd ramonjd requested a review from ajitbohra as a code owner May 18, 2022 02:16
@github-actions
Copy link

github-actions bot commented May 18, 2022

Size Change: +509 B (0%)

Total Size: 1.24 MB

Filename Size Change
build/block-library/blocks/columns/style-rtl.css 497 B +91 B (+22%) 🚨
build/block-library/blocks/columns/style.css 497 B +91 B (+22%) 🚨
build/block-library/index.min.js 181 kB +243 B (0%)
build/block-library/style-rtl.css 11.6 kB +42 B (0%)
build/block-library/style.css 11.6 kB +42 B (0%)
ℹ️ View Unchanged
Filename Size
build/a11y/index.min.js 993 B
build/annotations/index.min.js 2.75 kB
build/api-fetch/index.min.js 2.27 kB
build/autop/index.min.js 2.15 kB
build/blob/index.min.js 487 B
build/block-directory/index.min.js 6.51 kB
build/block-directory/style-rtl.css 1.01 kB
build/block-directory/style.css 1.01 kB
build/block-editor/default-editor-styles-rtl.css 378 B
build/block-editor/default-editor-styles.css 378 B
build/block-editor/index.min.js 151 kB
build/block-editor/style-rtl.css 14.6 kB
build/block-editor/style.css 14.6 kB
build/block-library/blocks/archives/editor-rtl.css 61 B
build/block-library/blocks/archives/editor.css 60 B
build/block-library/blocks/archives/style-rtl.css 65 B
build/block-library/blocks/archives/style.css 65 B
build/block-library/blocks/audio/editor-rtl.css 150 B
build/block-library/blocks/audio/editor.css 150 B
build/block-library/blocks/audio/style-rtl.css 111 B
build/block-library/blocks/audio/style.css 111 B
build/block-library/blocks/audio/theme-rtl.css 125 B
build/block-library/blocks/audio/theme.css 125 B
build/block-library/blocks/avatar/editor-rtl.css 116 B
build/block-library/blocks/avatar/editor.css 116 B
build/block-library/blocks/avatar/style-rtl.css 59 B
build/block-library/blocks/avatar/style.css 59 B
build/block-library/blocks/block/editor-rtl.css 161 B
build/block-library/blocks/block/editor.css 161 B
build/block-library/blocks/button/editor-rtl.css 445 B
build/block-library/blocks/button/editor.css 445 B
build/block-library/blocks/button/style-rtl.css 560 B
build/block-library/blocks/button/style.css 560 B
build/block-library/blocks/buttons/editor-rtl.css 292 B
build/block-library/blocks/buttons/editor.css 292 B
build/block-library/blocks/buttons/style-rtl.css 275 B
build/block-library/blocks/buttons/style.css 275 B
build/block-library/blocks/calendar/style-rtl.css 207 B
build/block-library/blocks/calendar/style.css 207 B
build/block-library/blocks/categories/editor-rtl.css 84 B
build/block-library/blocks/categories/editor.css 83 B
build/block-library/blocks/categories/style-rtl.css 79 B
build/block-library/blocks/categories/style.css 79 B
build/block-library/blocks/code/style-rtl.css 103 B
build/block-library/blocks/code/style.css 103 B
build/block-library/blocks/code/theme-rtl.css 124 B
build/block-library/blocks/code/theme.css 124 B
build/block-library/blocks/columns/editor-rtl.css 108 B
build/block-library/blocks/columns/editor.css 108 B
build/block-library/blocks/comment-author-avatar/editor-rtl.css 125 B
build/block-library/blocks/comment-author-avatar/editor.css 125 B
build/block-library/blocks/comment-content/style-rtl.css 92 B
build/block-library/blocks/comment-content/style.css 92 B
build/block-library/blocks/comment-template/style-rtl.css 127 B
build/block-library/blocks/comment-template/style.css 127 B
build/block-library/blocks/comments-pagination-numbers/editor-rtl.css 123 B
build/block-library/blocks/comments-pagination-numbers/editor.css 121 B
build/block-library/blocks/comments-pagination/editor-rtl.css 222 B
build/block-library/blocks/comments-pagination/editor.css 209 B
build/block-library/blocks/comments-pagination/style-rtl.css 235 B
build/block-library/blocks/comments-pagination/style.css 231 B
build/block-library/blocks/comments-title/editor-rtl.css 75 B
build/block-library/blocks/comments-title/editor.css 75 B
build/block-library/blocks/comments/editor-rtl.css 95 B
build/block-library/blocks/comments/editor.css 95 B
build/block-library/blocks/cover/editor-rtl.css 546 B
build/block-library/blocks/cover/editor.css 547 B
build/block-library/blocks/cover/style-rtl.css 1.56 kB
build/block-library/blocks/cover/style.css 1.56 kB
build/block-library/blocks/embed/editor-rtl.css 293 B
build/block-library/blocks/embed/editor.css 293 B
build/block-library/blocks/embed/style-rtl.css 417 B
build/block-library/blocks/embed/style.css 417 B
build/block-library/blocks/embed/theme-rtl.css 124 B
build/block-library/blocks/embed/theme.css 124 B
build/block-library/blocks/file/editor-rtl.css 300 B
build/block-library/blocks/file/editor.css 300 B
build/block-library/blocks/file/style-rtl.css 255 B
build/block-library/blocks/file/style.css 255 B
build/block-library/blocks/file/view.min.js 353 B
build/block-library/blocks/freeform/editor-rtl.css 2.44 kB
build/block-library/blocks/freeform/editor.css 2.44 kB
build/block-library/blocks/gallery/editor-rtl.css 961 B
build/block-library/blocks/gallery/editor.css 964 B
build/block-library/blocks/gallery/style-rtl.css 1.51 kB
build/block-library/blocks/gallery/style.css 1.51 kB
build/block-library/blocks/gallery/theme-rtl.css 122 B
build/block-library/blocks/gallery/theme.css 122 B
build/block-library/blocks/group/editor-rtl.css 333 B
build/block-library/blocks/group/editor.css 333 B
build/block-library/blocks/group/style-rtl.css 57 B
build/block-library/blocks/group/style.css 57 B
build/block-library/blocks/group/theme-rtl.css 78 B
build/block-library/blocks/group/theme.css 78 B
build/block-library/blocks/heading/style-rtl.css 76 B
build/block-library/blocks/heading/style.css 76 B
build/block-library/blocks/html/editor-rtl.css 332 B
build/block-library/blocks/html/editor.css 333 B
build/block-library/blocks/image/editor-rtl.css 738 B
build/block-library/blocks/image/editor.css 737 B
build/block-library/blocks/image/style-rtl.css 529 B
build/block-library/blocks/image/style.css 535 B
build/block-library/blocks/image/theme-rtl.css 124 B
build/block-library/blocks/image/theme.css 124 B
build/block-library/blocks/latest-comments/style-rtl.css 284 B
build/block-library/blocks/latest-comments/style.css 284 B
build/block-library/blocks/latest-posts/editor-rtl.css 199 B
build/block-library/blocks/latest-posts/editor.css 198 B
build/block-library/blocks/latest-posts/style-rtl.css 463 B
build/block-library/blocks/latest-posts/style.css 462 B
build/block-library/blocks/list/style-rtl.css 88 B
build/block-library/blocks/list/style.css 88 B
build/block-library/blocks/media-text/editor-rtl.css 266 B
build/block-library/blocks/media-text/editor.css 263 B
build/block-library/blocks/media-text/style-rtl.css 493 B
build/block-library/blocks/media-text/style.css 490 B
build/block-library/blocks/more/editor-rtl.css 431 B
build/block-library/blocks/more/editor.css 431 B
build/block-library/blocks/navigation-link/editor-rtl.css 708 B
build/block-library/blocks/navigation-link/editor.css 706 B
build/block-library/blocks/navigation-link/style-rtl.css 115 B
build/block-library/blocks/navigation-link/style.css 115 B
build/block-library/blocks/navigation-submenu/editor-rtl.css 299 B
build/block-library/blocks/navigation-submenu/editor.css 299 B
build/block-library/blocks/navigation-submenu/view.min.js 375 B
build/block-library/blocks/navigation/editor-rtl.css 2.03 kB
build/block-library/blocks/navigation/editor.css 2.04 kB
build/block-library/blocks/navigation/style-rtl.css 1.95 kB
build/block-library/blocks/navigation/style.css 1.94 kB
build/block-library/blocks/navigation/view-modal.min.js 2.78 kB
build/block-library/blocks/navigation/view.min.js 395 B
build/block-library/blocks/nextpage/editor-rtl.css 395 B
build/block-library/blocks/nextpage/editor.css 395 B
build/block-library/blocks/page-list/editor-rtl.css 363 B
build/block-library/blocks/page-list/editor.css 363 B
build/block-library/blocks/page-list/style-rtl.css 175 B
build/block-library/blocks/page-list/style.css 175 B
build/block-library/blocks/paragraph/editor-rtl.css 157 B
build/block-library/blocks/paragraph/editor.css 157 B
build/block-library/blocks/paragraph/style-rtl.css 260 B
build/block-library/blocks/paragraph/style.css 260 B
build/block-library/blocks/post-author/style-rtl.css 175 B
build/block-library/blocks/post-author/style.css 176 B
build/block-library/blocks/post-comments-form/editor-rtl.css 69 B
build/block-library/blocks/post-comments-form/editor.css 69 B
build/block-library/blocks/post-comments-form/style-rtl.css 495 B
build/block-library/blocks/post-comments-form/style.css 495 B
build/block-library/blocks/post-comments/editor-rtl.css 77 B
build/block-library/blocks/post-comments/editor.css 77 B
build/block-library/blocks/post-comments/style-rtl.css 628 B
build/block-library/blocks/post-comments/style.css 628 B
build/block-library/blocks/post-excerpt/editor-rtl.css 73 B
build/block-library/blocks/post-excerpt/editor.css 73 B
build/block-library/blocks/post-excerpt/style-rtl.css 69 B
build/block-library/blocks/post-excerpt/style.css 69 B
build/block-library/blocks/post-featured-image/editor-rtl.css 721 B
build/block-library/blocks/post-featured-image/editor.css 721 B
build/block-library/blocks/post-featured-image/style-rtl.css 153 B
build/block-library/blocks/post-featured-image/style.css 153 B
build/block-library/blocks/post-template/editor-rtl.css 99 B
build/block-library/blocks/post-template/editor.css 98 B
build/block-library/blocks/post-template/style-rtl.css 323 B
build/block-library/blocks/post-template/style.css 323 B
build/block-library/blocks/post-terms/style-rtl.css 73 B
build/block-library/blocks/post-terms/style.css 73 B
build/block-library/blocks/post-title/style-rtl.css 80 B
build/block-library/blocks/post-title/style.css 80 B
build/block-library/blocks/preformatted/style-rtl.css 103 B
build/block-library/blocks/preformatted/style.css 103 B
build/block-library/blocks/pullquote/editor-rtl.css 198 B
build/block-library/blocks/pullquote/editor.css 198 B
build/block-library/blocks/pullquote/style-rtl.css 370 B
build/block-library/blocks/pullquote/style.css 370 B
build/block-library/blocks/pullquote/theme-rtl.css 167 B
build/block-library/blocks/pullquote/theme.css 167 B
build/block-library/blocks/query-pagination-numbers/editor-rtl.css 122 B
build/block-library/blocks/query-pagination-numbers/editor.css 121 B
build/block-library/blocks/query-pagination/editor-rtl.css 221 B
build/block-library/blocks/query-pagination/editor.css 211 B
build/block-library/blocks/query-pagination/style-rtl.css 234 B
build/block-library/blocks/query-pagination/style.css 231 B
build/block-library/blocks/query/editor-rtl.css 369 B
build/block-library/blocks/query/editor.css 369 B
build/block-library/blocks/quote/style-rtl.css 213 B
build/block-library/blocks/quote/style.css 213 B
build/block-library/blocks/quote/theme-rtl.css 223 B
build/block-library/blocks/quote/theme.css 226 B
build/block-library/blocks/read-more/style-rtl.css 132 B
build/block-library/blocks/read-more/style.css 132 B
build/block-library/blocks/rss/editor-rtl.css 202 B
build/block-library/blocks/rss/editor.css 204 B
build/block-library/blocks/rss/style-rtl.css 289 B
build/block-library/blocks/rss/style.css 288 B
build/block-library/blocks/search/editor-rtl.css 165 B
build/block-library/blocks/search/editor.css 165 B
build/block-library/blocks/search/style-rtl.css 397 B
build/block-library/blocks/search/style.css 398 B
build/block-library/blocks/search/theme-rtl.css 64 B
build/block-library/blocks/search/theme.css 64 B
build/block-library/blocks/separator/editor-rtl.css 146 B
build/block-library/blocks/separator/editor.css 146 B
build/block-library/blocks/separator/style-rtl.css 233 B
build/block-library/blocks/separator/style.css 233 B
build/block-library/blocks/separator/theme-rtl.css 194 B
build/block-library/blocks/separator/theme.css 194 B
build/block-library/blocks/shortcode/editor-rtl.css 474 B
build/block-library/blocks/shortcode/editor.css 474 B
build/block-library/blocks/site-logo/editor-rtl.css 759 B
build/block-library/blocks/site-logo/editor.css 759 B
build/block-library/blocks/site-logo/style-rtl.css 192 B
build/block-library/blocks/site-logo/style.css 192 B
build/block-library/blocks/site-tagline/editor-rtl.css 86 B
build/block-library/blocks/site-tagline/editor.css 86 B
build/block-library/blocks/site-title/editor-rtl.css 84 B
build/block-library/blocks/site-title/editor.css 84 B
build/block-library/blocks/social-link/editor-rtl.css 177 B
build/block-library/blocks/social-link/editor.css 177 B
build/block-library/blocks/social-links/editor-rtl.css 674 B
build/block-library/blocks/social-links/editor.css 673 B
build/block-library/blocks/social-links/style-rtl.css 1.37 kB
build/block-library/blocks/social-links/style.css 1.36 kB
build/block-library/blocks/spacer/editor-rtl.css 332 B
build/block-library/blocks/spacer/editor.css 332 B
build/block-library/blocks/spacer/style-rtl.css 48 B
build/block-library/blocks/spacer/style.css 48 B
build/block-library/blocks/table/editor-rtl.css 504 B
build/block-library/blocks/table/editor.css 504 B
build/block-library/blocks/table/style-rtl.css 625 B
build/block-library/blocks/table/style.css 625 B
build/block-library/blocks/table/theme-rtl.css 188 B
build/block-library/blocks/table/theme.css 188 B
build/block-library/blocks/tag-cloud/style-rtl.css 226 B
build/block-library/blocks/tag-cloud/style.css 227 B
build/block-library/blocks/template-part/editor-rtl.css 149 B
build/block-library/blocks/template-part/editor.css 149 B
build/block-library/blocks/template-part/theme-rtl.css 101 B
build/block-library/blocks/template-part/theme.css 101 B
build/block-library/blocks/text-columns/editor-rtl.css 95 B
build/block-library/blocks/text-columns/editor.css 95 B
build/block-library/blocks/text-columns/style-rtl.css 166 B
build/block-library/blocks/text-columns/style.css 166 B
build/block-library/blocks/verse/style-rtl.css 87 B
build/block-library/blocks/verse/style.css 87 B
build/block-library/blocks/video/editor-rtl.css 561 B
build/block-library/blocks/video/editor.css 563 B
build/block-library/blocks/video/style-rtl.css 173 B
build/block-library/blocks/video/style.css 173 B
build/block-library/blocks/video/theme-rtl.css 124 B
build/block-library/blocks/video/theme.css 124 B
build/block-library/common-rtl.css 993 B
build/block-library/common.css 990 B
build/block-library/editor-rtl.css 10.2 kB
build/block-library/editor.css 10.3 kB
build/block-library/reset-rtl.css 478 B
build/block-library/reset.css 478 B
build/block-library/theme-rtl.css 689 B
build/block-library/theme.css 694 B
build/block-serialization-default-parser/index.min.js 1.12 kB
build/block-serialization-spec-parser/index.min.js 2.83 kB
build/blocks/index.min.js 47.1 kB
build/components/index.min.js 228 kB
build/components/style-rtl.css 13.9 kB
build/components/style.css 13.9 kB
build/compose/index.min.js 11.7 kB
build/core-data/index.min.js 14.6 kB
build/customize-widgets/index.min.js 11.2 kB
build/customize-widgets/style-rtl.css 1.4 kB
build/customize-widgets/style.css 1.4 kB
build/data-controls/index.min.js 663 B
build/data/index.min.js 7.98 kB
build/date/index.min.js 32 kB
build/deprecated/index.min.js 518 B
build/dom-ready/index.min.js 336 B
build/dom/index.min.js 4.69 kB
build/edit-navigation/index.min.js 16 kB
build/edit-navigation/style-rtl.css 4.05 kB
build/edit-navigation/style.css 4.05 kB
build/edit-post/classic-rtl.css 546 B
build/edit-post/classic.css 547 B
build/edit-post/index.min.js 30.3 kB
build/edit-post/style-rtl.css 7.08 kB
build/edit-post/style.css 7.08 kB
build/edit-site/index.min.js 47.9 kB
build/edit-site/style-rtl.css 7.73 kB
build/edit-site/style.css 7.71 kB
build/edit-widgets/index.min.js 16.4 kB
build/edit-widgets/style-rtl.css 4.4 kB
build/edit-widgets/style.css 4.4 kB
build/editor/index.min.js 38.5 kB
build/editor/style-rtl.css 3.71 kB
build/editor/style.css 3.7 kB
build/element/index.min.js 4.3 kB
build/escape-html/index.min.js 548 B
build/format-library/index.min.js 6.62 kB
build/format-library/style-rtl.css 571 B
build/format-library/style.css 571 B
build/hooks/index.min.js 1.66 kB
build/html-entities/index.min.js 454 B
build/i18n/index.min.js 3.79 kB
build/is-shallow-equal/index.min.js 535 B
build/keyboard-shortcuts/index.min.js 1.8 kB
build/keycodes/index.min.js 1.41 kB
build/list-reusable-blocks/index.min.js 1.75 kB
build/list-reusable-blocks/style-rtl.css 835 B
build/list-reusable-blocks/style.css 835 B
build/media-utils/index.min.js 2.9 kB
build/notices/index.min.js 957 B
build/nux/index.min.js 2.07 kB
build/nux/style-rtl.css 744 B
build/nux/style.css 741 B
build/plugins/index.min.js 1.98 kB
build/preferences-persistence/index.min.js 2.23 kB
build/preferences/index.min.js 1.32 kB
build/primitives/index.min.js 949 B
build/priority-queue/index.min.js 628 B
build/react-i18n/index.min.js 704 B
build/react-refresh-entry/index.min.js 8.44 kB
build/react-refresh-runtime/index.min.js 7.31 kB
build/redux-routine/index.min.js 2.69 kB
build/reusable-blocks/index.min.js 2.24 kB
build/reusable-blocks/style-rtl.css 256 B
build/reusable-blocks/style.css 256 B
build/rich-text/index.min.js 11.1 kB
build/server-side-render/index.min.js 1.61 kB
build/shortcode/index.min.js 1.52 kB
build/token-list/index.min.js 668 B
build/url/index.min.js 1.99 kB
build/vendors/react-dom.min.js 38.5 kB
build/vendors/react.min.js 4.34 kB
build/viewport/index.min.js 1.08 kB
build/warning/index.min.js 280 B
build/widgets/index.min.js 7.2 kB
build/widgets/style-rtl.css 1.16 kB
build/widgets/style.css 1.16 kB
build/wordcount/index.min.js 1.07 kB

compressed-size-action

@glendaviesnz
Copy link
Contributor

What would make this particular definition more robust is if we could do the following dynamically: ( var(--wp--style--block-gap, 2em) + style.spacing.blockGap

@ramon could we do the same as the Gallery block here and add a CSS var for the column blockGap?

This var is added to the editor here, and frontend here.

If it was possible we should potentially extract these to a shared component/render method as I think they just need the addition of a css var name prop to work in both contexts.

Just note there is an open PR to modify the frontend loading of this style slightly.

@ramonjd
Copy link
Member Author

ramonjd commented May 18, 2022

could we do the same as the Gallery block here and add a CSS var for the column blockGap?

Awesome, thanks for raising that @glendaviesnz

Yeah I reckon we should try it out.

Just for the record and nothing else, I had a PR to test whether we could create 2 x blockGap vars to fix the block-level blockGap bug:

  • --wp--style--root--block--gap that houses the "root" global styles value for the site and that can act as a fallback for
  • --wp--style--block-gap, which is set at the block level, can be used by individual blocks/layout implementation if available

Seems as if it'd also address this error, but the double CSS var hasn't been discussed yet and so the gallery experience might be the way to go.

@ramonjd
Copy link
Member Author

ramonjd commented May 19, 2022

@glendaviesnz I took a stab at your suggestion.

Does this look/work okay to you? 7fe65e3

I haven't yet taken into account your changes in #41015

@glendaviesnz
Copy link
Contributor

Seems to work as expected for me:

column-after.mp4

What do you think about moving the GapStyles component somewhere like /packages/block-editor/src/hooks/color-panel.js and adding a cssVar prop so it can be shared by columns and gallery?

@ramonjd
Copy link
Member Author

ramonjd commented May 19, 2022

What do you think about moving the GapStyles component somewhere like /packages/block-editor/src/hooks/color-panel.js and adding a cssVar prop so it can be shared by columns and gallery?

I'd say it's probably worth it 👍

@ramonjd
Copy link
Member Author

ramonjd commented May 19, 2022

What do you think about moving the GapStyles component somewhere like /packages/block-editor/src/hooks/color-panel.js and adding a cssVar prop so it can be shared by columns and gallery?

I'd say it's probably worth it 👍

Actually, worth it, but okay for another PR? Just don't want to lose focus of the fix itself.

What do you reckon?

@glendaviesnz
Copy link
Contributor

Actually, worth it, but okay for another PR?

For sure, follow PR fine.

@ramonjd ramonjd force-pushed the try/columns-block-reinstate-tablet-view branch from 08b6922 to 4517272 Compare May 20, 2022 00:12
@ramonjd
Copy link
Member Author

ramonjd commented May 20, 2022

Tested with core themes 2011 - 2022, and a few custom themes.

Looking okay to me, but I'm probably biased 😄

Example block code
<!-- wp:columns {"style":{"spacing":{"margin":{"bottom":"47px","top":"115px"}}}} -->
<div class="wp-block-columns" style="margin-top:115px;margin-bottom:47px"><!-- wp:column {"style":{"color":{"background":"#eaed48"}}} -->
<div class="wp-block-column has-background" style="background-color:#eaed48"><!-- wp:paragraph -->
<p>Column</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->

<!-- wp:column {"style":{"color":{"background":"#eaed48"}}} -->
<div class="wp-block-column has-background" style="background-color:#eaed48"><!-- wp:paragraph -->
<p>Column</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:columns {"style":{"spacing":{"blockGap":"151px"}}} -->
<div class="wp-block-columns"><!-- wp:column {"style":{"color":{"background":"#ffccd8"},"spacing":{"padding":{"top":"10px","right":"10px","bottom":"10px","left":"10px"}}}} -->
<div class="wp-block-column has-background" style="background-color:#ffccd8;padding-top:10px;padding-right:10px;padding-bottom:10px;padding-left:10px"><!-- wp:paragraph {"style":{"color":{"text":"#0b0b0b"}}} -->
<p class="has-text-color" style="color:#0b0b0b">Column with custom block gap and padding</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->

<!-- wp:column {"style":{"color":{"background":"#ffccd8"},"spacing":{"padding":{"top":"10px","right":"10px","bottom":"10px","left":"10px"}}}} -->
<div class="wp-block-column has-background" style="background-color:#ffccd8;padding-top:10px;padding-right:10px;padding-bottom:10px;padding-left:10px"><!-- wp:paragraph {"style":{"color":{"text":"#0b0b0b"}}} -->
<p class="has-text-color" style="color:#0b0b0b">Column with custom block gap and padding</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->

<!-- wp:column {"style":{"color":{"background":"#ffccd8"},"spacing":{"padding":{"top":"10px","right":"10px","bottom":"10px","left":"10px"}}}} -->
<div class="wp-block-column has-background" style="background-color:#ffccd8;padding-top:10px;padding-right:10px;padding-bottom:10px;padding-left:10px"><!-- wp:paragraph {"style":{"color":{"text":"#0b0b0b"}}} -->
<p class="has-text-color" style="color:#0b0b0b">Column with custom block gap and padding</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:columns {"style":{"spacing":{"blockGap":"14px"}}} -->
<div class="wp-block-columns"><!-- wp:column {"style":{"color":{"background":"#b3002a"},"spacing":{"blockGap":"89px"}}} -->
<div class="wp-block-column has-background" style="background-color:#b3002a"><!-- wp:paragraph -->
<p>Column</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->

<!-- wp:column {"style":{"color":{"background":"#b3002a"}}} -->
<div class="wp-block-column has-background" style="background-color:#b3002a"><!-- wp:paragraph -->
<p>Column</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->

<!-- wp:column {"style":{"color":{"background":"#b3002a"}}} -->
<div class="wp-block-column has-background" style="background-color:#b3002a"><!-- wp:paragraph -->
<p>Column</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->

<!-- wp:column {"style":{"color":{"background":"#b3002a"}}} -->
<div class="wp-block-column has-background" style="background-color:#b3002a"><!-- wp:paragraph -->
<p>Column</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column -->

<!-- wp:column {"style":{"color":{"background":"#b3002a"}}} -->
<div class="wp-block-column has-background" style="background-color:#b3002a"><!-- wp:paragraph -->
<p>Column</p>
<!-- /wp:paragraph --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:columns {"style":{"spacing":{"blockGap":"185px"}}} -->
<div class="wp-block-columns"><!-- wp:column {"style":{"color":{"background":"#ecffae"}}} -->
<div class="wp-block-column has-background" style="background-color:#ecffae"><!-- wp:group -->
<div class="wp-block-group"><!-- wp:paragraph -->
<p>A paragraph inside a Group block inside a Column.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>A paragraph inside a Group block inside a Column.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>A paragraph inside a Group block inside a Column.</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>A paragraph inside a Group block inside a Column.</p>
<!-- /wp:paragraph --></div>
<!-- /wp:group -->

<!-- wp:social-links {"style":{"spacing":{"blockGap":{"top":"68px","left":"68px"}}}} -->
<ul class="wp-block-social-links"><!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /-->

<!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /-->

<!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /-->

<!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /-->

<!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /-->

<!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /-->

<!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /-->

<!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /-->

<!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /-->

<!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /-->

<!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /-->

<!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /-->

<!-- wp:social-link {"url":"https://wordpress.org","service":"wordpress"} /--></ul>
<!-- /wp:social-links --></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

Screen Shot 2022-05-20 at 10 09 08 am

@ramonjd ramonjd requested a review from scruffian May 20, 2022 00:35
@ramonjd
Copy link
Member Author

ramonjd commented May 20, 2022

@scruffian Do you reckon this PR is worth pursuing or will it create more headaches for themes?

The TL;DR is that we forced stacking for mobile AND tablet in #37436

Before, at tablet widths, we forced a 2 col 50% 50% split.

This PR brings us back to that, but via fairly complex route.

@scruffian
Copy link
Contributor

Themes that use columns for layout (Stewart and Remote) are examples of why we removed this rule in the first place. Right now the only tool we have for doing sidebar style layouts is the columns block, and in these cases splitting the columns 50/50 creates quite an unexpected layout on sites using these themes.

When we removed the rule we were aware that it would introduce this regression but we also felt like the original rule was a mistake and so removing it seemed like the best course of action. I'm not a fan of bringing it back!

We could consider adding a UI to control this, but we also need to be careful to make something that is easy enough to use and understand as well as giving us the flexibility we need. One option to explore might be to set a "minimum width" for columns so that we break when that is reached...

@marctison75
Copy link

Hi,

I'm the one who reported this issue on trac. Thanks for this PR.

While I understand that stacking columns on tablets could be useful for some layouts (e.g. site with sidebar), these layouts are minor and can be handled by the themes. However, I don't think it would be a good idea to totally change the design and break the front-end of millions of websites without users knowing about it and without having the possibility of repairing it.

I hope this PR will be included in WordPress 6.0

@ramonjd
Copy link
Member Author

ramonjd commented May 22, 2022

Right now the only tool we have for doing sidebar style layouts is the columns block, and in these cases splitting the columns 50/50 creates quite an unexpected layout on sites using these themes

This is a good point, thanks for raising it.

When we removed the rule we were aware that it would introduce this regression but we also felt like the original rule was a mistake and so removing it seemed like the best course of action. I'm not a fan of bringing it back

We could consider adding a UI to control this, but we also need to be careful to make something that is easy enough to use and understand as well as giving us the flexibility we need. One option to explore might be to set a "minimum width" for columns so that we break when that is reached...

Yeah, a 50%/50% split does seem a bit opinionated. Removing the rule, I think, was less risky since it only applied to a breakpoint window of 181px. Breakpoints are still meaningful, but as the preference for fluid layouts grows, "tablet" will become meaningless and the bandaid will be trickier to rip off.

As for an accompanying UI control, it's a great idea. I don't expect @andrewserong to mind if I show off one of his experiments.

2022-05-20_10 29 02

I don't think it would be a good idea to totally change the design and break the front-end of millions of websites without users knowing about it and without having the possibility of repairing it.

I hope this PR will be included in WordPress 6.0

I think we missed the boat on WordPress 6.0 unfortunately, but maybe we could strike a balance here in time for the next release by adding a UI control that achieves the tablet 50/50 split (?).

Edit: I forgot to mention that, whatever idea we come up with, we should probably compose a dev note on the WordPress Core blog to explain the change.

@andrewserong
Copy link
Contributor

Just to keep the discussion / ideas going, I've put up an experimental PR in #41295 to see what it looks like with an added conditional UI control for controlling the number of columns at tablet screen sizes.

One option to explore might be to set a "minimum width" for columns so that we break when that is reached...

While the experimental PR I put up technically kinda works, I think I prefer the idea of columns being able to collapse / expand based on min / max widths. It'd be really neat, say, to be able to have a 4 column layout that on mobile sizes collapses down to 50% max-width, so that it's 2 column on mobile and 4 column on desktops.

I don't quite have enough time to go down another rabbithole with that idea just yet, but if no-one beats me to it, I'd be keen to have a play with min / max widths for columns to see what could potentially be viable there, too.

@ramonjd
Copy link
Member Author

ramonjd commented May 25, 2022

I don't quite have enough time to go down another rabbithole with that idea just yet, but if no-one beats me to it, I'd be keen to have a play with min / max widths for columns to see what could potentially be viable there, too

Thanks @andrewserong

I tried to have a think about an alternative way of controlling the column behaviour at narrower widths, but couldn't come up with anything intuitive so far.

Here's this PR in action

columns-tablet-2-col-collapse.mp4

So that's an effect we'd like to achieve with the given variables.

I can't see a way around our defined breakpoints, so maybe something along the lines of #41295 would work, possibly something along the lines of "How many columns would you like at each of the 3 breakpoints?"

Seems overly complex, at least the idea. 🤷

@andrewserong
Copy link
Contributor

Thanks for taking a look, Ramon!

but couldn't come up with anything intuitive so far.

Me either! Any of the ideas I've come up with so far wind up creating complex and not-particularly-intuitive interfaces. Though, I suppose if we relied on column-based attributes for minimum and maximum widths, etc, we could abstract it a little by hiding it behind block patterns, but it still gets overly complex quite quickly (and there's lots of edge-case-ey behaviour to deal with).

Seems overly complex, at least the idea.

Yes, it does seem like the crux of the issue is how to make a complex thing flexible and easy to work with to suit a range of different patterns and themes 🤔

@scruffian
Copy link
Contributor

Perhaps using the columns block for creating sidebar layouts is an abuse of the intention of the block. Maybe another option to explore is a new "layout" block which allows different layout options (for example, main content and sidebar).

@ramonjd
Copy link
Member Author

ramonjd commented May 30, 2022

There is another option: block styles

columns-tablet-stack.mp4

It's a simple change, however I would be wary about future deprecations. For example, if we decide to remove the style we'll have to ensure backwards compatibility.

@ramonjd ramonjd force-pushed the try/columns-block-reinstate-tablet-view branch from 4517272 to 37ed4ed Compare May 31, 2022 00:42
@ramonjd
Copy link
Member Author

ramonjd commented May 31, 2022

It's a simple change, however I would be wary about future deprecations. For example, if we decide to remove the style we'll have to ensure backwards compatibility.

I've added this since it appears to me to be a fairly frictionless way to add the tablet stack view back in. Happy to dump or revert if it's too much.

@andrewserong
Copy link
Contributor

I've added this since it appears to me to be a fairly frictionless way to add the tablet stack view back in. Happy to dump or revert if it's too much.

I think that sounds like the best compromise so far — avoids the complexity of adding additional controls as in #41295, and ensures users can choose either behaviour (preserve the old 2 column on tablet behaviour, or avoid that breakpoint altogether).

In terms of backwards compatibility and keeping the style around indefinitely, I wonder if the work in #41020 will make that less of an issue — e.g. if the tree-shaking-like approach is used for outputting CSS based on the classnames present in the rendered / stored block markup, then perhaps it'd be easier to keep older CSS around in the repo, because we wouldn't need to worry about the performance issues of it still being there? Just a thought 🙂

I'd be keen to see what folks think about the addition of the block style, too!

"label": "Default",
"isDefault": true
},
{ "name": "tablet-stack", "label": "Tablet stack" }
Copy link
Member Author

Choose a reason for hiding this comment

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

Just jotting down a brain spasm: I was wondering if we should toggle the style off when isStackedOnMobile !== true

It might cause extra confusion though remembering to toggle it back on.

@aristath
Copy link
Member

Just tossing another idea here.
I always disliked the concept of a "breakpoint", so last year I tried to allow wrapping columns on mobile/tablet/small screens without the use of a hardcoded arbitrary breakpoint. To do that, in #33330/files I was adding a new columnMinWidth control to columns. This way the user can define on their own what the minimum width of a column should be, and if it doesn't fit, then it collapses to the row below.
A solution similar to that can accommodate all screen sizes, and can also be used to ensure that text in a column for example remains readable, by defining something like min-width: 10em.

@dennisheiden
Copy link

Just my thoughts on columns:

For less complex sites and WP light users, the stackings option and columns management is a good option I think.
But in my experience for complex sites, or what we have dev on daily basis, columns can be a pain if you have more than two in a row.

We are currently adding extended settings to every core block to be more flexible and to have to code less block styles (complex designs mean a lot of custom styles which is a mess in the UI):

image

What we did is to add an opt-in columns control which forces columns to be flex all the time and allow ordering, flex gap and stacking. We use more breakpoints than other sites, but that's not the deal. Those breakpoints are adjustable either in our theme or in the plugin which provides those settings - so not hardcoded.

This might be an edge case for most Gutenberg devs IMO, but the biggest thing Gutenberg is missing is real responsive support for medium to heavy complex layouts.

This is just our view on the topic, no feature request or critic to specific Gutenberg principles.

@ramonjd
Copy link
Member Author

ramonjd commented Jun 2, 2022

To do that, in #33330/files I was adding a new columnMinWidth control to columns. This way the user can define on their own what the minimum width of a column should be, and if it doesn't fit, then it collapses to the row below.

Screen Shot 2022-06-02 at 9 48 45 am

Sorry I looked! :trollface:

That's an interesting approach, thanks for sharing @aristath

The motivation behind this PR was to attempt a clean way to reinstate the tablet-view stacking. It's a hard one as columns are used for larger, site-wide layouts and this stacking is undesirable.

I'd be interested to see if I can borrow your idea, as possibly a new attribute + UI is called for. What I've got so far with the block style feels a little "band aid" to me.

This might be an edge case for most Gutenberg devs IMO, but the biggest thing Gutenberg is missing is real responsive support for medium to heavy complex layouts.

Thanks for the thoughts and the screenshot @dennisheiden Good to have this to mull over.

This issue might interest you as well:

There's interest in fluid design, but yeah, it won't happen overnight.

@ramonjd
Copy link
Member Author

ramonjd commented Sep 27, 2022

Closing this as it's stale. If we need to address this in the future we can reopen.

@ramonjd ramonjd closed this Sep 27, 2022
@ramonjd ramonjd deleted the try/columns-block-reinstate-tablet-view branch September 27, 2022 03:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Columns Affects the Columns Block [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants