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

Add Column Start and Row Start controls to Grid children #59483

Merged
merged 16 commits into from Mar 14, 2024

Conversation

noisysocks
Copy link
Member

@noisysocks noisysocks commented Feb 29, 2024

What?

Largely follow #58539. Part of #57478.

Adds Column Start and Row Start controls to the block inspector for items that are a child of grid layout.

Also rejigs the grouping of the existing Tool Panel items so that we have Grid position and Grid span in the menu. See #59488. Props @tellthemachines.

Why?

As part of #57478 I'm working on letting the user drag and drop items within a grid to position them manually. For this to work we need to be able to set style.layout.columnStart and style.layout.rowStart and we'll need a keyboard accessible alternative for setting these attributes. This PR adds both.

How?

Most of the work is already done by #58539. I'm just adjusting how we output grid-column and grid-row and adding two new InputControls.

Testing Instructions

  1. Insert a Grid block.
  2. Add some child blocks to the Grid.
  3. Select one of the children.
  4. The Column Start and Row Start controls should appear in the block inspector.

Screenshots or screencast

Kapture.2024-03-01.at.10.43.28.mp4

@noisysocks noisysocks added [Type] Enhancement A suggestion for improvement. [Feature] Layout Layout block support, its UI controls, and style output. labels Feb 29, 2024
@noisysocks noisysocks self-assigned this Feb 29, 2024
Copy link

github-actions bot commented Feb 29, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: tellthemachines <isabel_brison@git.wordpress.org>
Co-authored-by: noisysocks <noisysocks@git.wordpress.org>
Co-authored-by: andrewserong <andrewserong@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@noisysocks noisysocks changed the title Grid: Add Column Start and Row Start controls to block inspector Add Column Start and Row Start controls to Grid children Feb 29, 2024
Copy link

github-actions bot commented Feb 29, 2024

This pull request changed or added PHP files in previous commits, but none have been detected in the latest commit.

Thank you! ❤️

Copy link

github-actions bot commented Feb 29, 2024

Size Change: +98 B (0%)

Total Size: 1.71 MB

Filename Size Change
build/block-editor/content-rtl.css 4.4 kB +19 B (0%)
build/block-editor/content.css 4.4 kB +16 B (0%)
build/block-editor/index.min.js 252 kB -165 B (0%)
build/block-editor/style-rtl.css 15.6 kB -79 B (-1%)
build/block-editor/style.css 15.6 kB -85 B (-1%)
build/block-library/blocks/media-text/editor-rtl.css 306 B +40 B (+15%) ⚠️
build/block-library/blocks/media-text/editor.css 305 B +42 B (+16%) ⚠️
build/block-library/blocks/social-links/style-rtl.css 1.48 kB -5 B (0%)
build/block-library/blocks/social-links/style.css 1.48 kB -5 B (0%)
build/block-library/editor-rtl.css 12.4 kB +19 B (0%)
build/block-library/editor.css 12.4 kB +20 B (0%)
build/block-library/index.min.js 217 kB +623 B (0%)
build/block-library/style-rtl.css 14.8 kB -6 B (0%)
build/block-library/style.css 14.8 kB -6 B (0%)
build/blocks/index.min.js 51.8 kB +8 B (0%)
build/components/index.min.js 223 kB -44 B (0%)
build/components/style.css 11.8 kB +1 B (0%)
build/customize-widgets/index.min.js 11.2 kB -884 B (-7%)
build/customize-widgets/style-rtl.css 1.36 kB +24 B (+2%)
build/customize-widgets/style.css 1.36 kB +26 B (+2%)
build/edit-post/index.min.js 24.2 kB +415 B (+2%)
build/edit-post/style-rtl.css 5.58 kB -74 B (-1%)
build/edit-post/style.css 5.57 kB -74 B (-1%)
build/edit-site/index.min.js 217 kB +1.25 kB (+1%)
build/edit-site/style-rtl.css 15 kB -405 B (-3%)
build/edit-site/style.css 15 kB -415 B (-3%)
build/edit-widgets/index.min.js 17.3 kB -47 B (0%)
build/edit-widgets/style-rtl.css 4.17 kB -66 B (-2%)
build/edit-widgets/style.css 4.16 kB -67 B (-2%)
build/editor/index.min.js 63.8 kB -189 B (0%)
build/format-library/index.min.js 8.02 kB +131 B (+2%)
build/interactivity/index.min.js 13 kB +72 B (+1%)
build/media-utils/index.min.js 2.91 kB +15 B (+1%)
build/patterns/index.min.js 5.71 kB -65 B (-1%)
build/preferences/index.min.js 2.8 kB -20 B (-1%)
build/rich-text/index.min.js 10.5 kB +83 B (+1%)
ℹ️ View Unchanged
Filename Size
build/a11y/index.min.js 955 B
build/annotations/index.min.js 2.69 kB
build/api-fetch/index.min.js 2.32 kB
build/autop/index.min.js 2.1 kB
build/blob/index.min.js 578 B
build/block-directory/index.min.js 7.22 kB
build/block-directory/style-rtl.css 1.03 kB
build/block-directory/style.css 1.03 kB
build/block-editor/default-editor-styles-rtl.css 394 B
build/block-editor/default-editor-styles.css 394 B
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 90 B
build/block-library/blocks/archives/style.css 90 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 122 B
build/block-library/blocks/audio/style.css 122 B
build/block-library/blocks/audio/theme-rtl.css 126 B
build/block-library/blocks/audio/theme.css 126 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 104 B
build/block-library/blocks/avatar/style.css 104 B
build/block-library/blocks/block/editor-rtl.css 305 B
build/block-library/blocks/block/editor.css 305 B
build/block-library/blocks/button/editor-rtl.css 415 B
build/block-library/blocks/button/editor.css 414 B
build/block-library/blocks/button/style-rtl.css 627 B
build/block-library/blocks/button/style.css 626 B
build/block-library/blocks/buttons/editor-rtl.css 337 B
build/block-library/blocks/buttons/editor.css 337 B
build/block-library/blocks/buttons/style-rtl.css 332 B
build/block-library/blocks/buttons/style.css 332 B
build/block-library/blocks/calendar/style-rtl.css 239 B
build/block-library/blocks/calendar/style.css 239 B
build/block-library/blocks/categories/editor-rtl.css 113 B
build/block-library/blocks/categories/editor.css 112 B
build/block-library/blocks/categories/style-rtl.css 124 B
build/block-library/blocks/categories/style.css 124 B
build/block-library/blocks/code/editor-rtl.css 53 B
build/block-library/blocks/code/editor.css 53 B
build/block-library/blocks/code/style-rtl.css 121 B
build/block-library/blocks/code/style.css 121 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/columns/style-rtl.css 421 B
build/block-library/blocks/columns/style.css 421 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 199 B
build/block-library/blocks/comment-template/style.css 198 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 840 B
build/block-library/blocks/comments/editor.css 839 B
build/block-library/blocks/comments/style-rtl.css 637 B
build/block-library/blocks/comments/style.css 636 B
build/block-library/blocks/cover/editor-rtl.css 647 B
build/block-library/blocks/cover/editor.css 650 B
build/block-library/blocks/cover/style-rtl.css 1.69 kB
build/block-library/blocks/cover/style.css 1.68 kB
build/block-library/blocks/details/editor-rtl.css 65 B
build/block-library/blocks/details/editor.css 65 B
build/block-library/blocks/details/style-rtl.css 98 B
build/block-library/blocks/details/style.css 98 B
build/block-library/blocks/embed/editor-rtl.css 322 B
build/block-library/blocks/embed/editor.css 322 B
build/block-library/blocks/embed/style-rtl.css 410 B
build/block-library/blocks/embed/style.css 410 B
build/block-library/blocks/embed/theme-rtl.css 126 B
build/block-library/blocks/embed/theme.css 126 B
build/block-library/blocks/file/editor-rtl.css 316 B
build/block-library/blocks/file/editor.css 316 B
build/block-library/blocks/file/style-rtl.css 280 B
build/block-library/blocks/file/style.css 281 B
build/block-library/blocks/file/view.min.js 324 B
build/block-library/blocks/footnotes/style-rtl.css 201 B
build/block-library/blocks/footnotes/style.css 199 B
build/block-library/blocks/form-input/editor-rtl.css 227 B
build/block-library/blocks/form-input/editor.css 227 B
build/block-library/blocks/form-input/style-rtl.css 343 B
build/block-library/blocks/form-input/style.css 343 B
build/block-library/blocks/form-submission-notification/editor-rtl.css 340 B
build/block-library/blocks/form-submission-notification/editor.css 340 B
build/block-library/blocks/form-submit-button/style-rtl.css 69 B
build/block-library/blocks/form-submit-button/style.css 69 B
build/block-library/blocks/form/view.min.js 471 B
build/block-library/blocks/freeform/editor-rtl.css 2.61 kB
build/block-library/blocks/freeform/editor.css 2.61 kB
build/block-library/blocks/gallery/editor-rtl.css 947 B
build/block-library/blocks/gallery/editor.css 952 B
build/block-library/blocks/gallery/style-rtl.css 1.72 kB
build/block-library/blocks/gallery/style.css 1.72 kB
build/block-library/blocks/gallery/theme-rtl.css 108 B
build/block-library/blocks/gallery/theme.css 108 B
build/block-library/blocks/group/editor-rtl.css 647 B
build/block-library/blocks/group/editor.css 647 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 189 B
build/block-library/blocks/heading/style.css 189 B
build/block-library/blocks/html/editor-rtl.css 336 B
build/block-library/blocks/html/editor.css 337 B
build/block-library/blocks/image/editor-rtl.css 894 B
build/block-library/blocks/image/editor.css 893 B
build/block-library/blocks/image/style-rtl.css 1.6 kB
build/block-library/blocks/image/style.css 1.59 kB
build/block-library/blocks/image/theme-rtl.css 126 B
build/block-library/blocks/image/theme.css 126 B
build/block-library/blocks/image/view.min.js 1.54 kB
build/block-library/blocks/latest-comments/style-rtl.css 357 B
build/block-library/blocks/latest-comments/style.css 357 B
build/block-library/blocks/latest-posts/editor-rtl.css 213 B
build/block-library/blocks/latest-posts/editor.css 212 B
build/block-library/blocks/latest-posts/style-rtl.css 478 B
build/block-library/blocks/latest-posts/style.css 478 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/style-rtl.css 505 B
build/block-library/blocks/media-text/style.css 503 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 668 B
build/block-library/blocks/navigation-link/editor.css 669 B
build/block-library/blocks/navigation-link/style-rtl.css 259 B
build/block-library/blocks/navigation-link/style.css 257 B
build/block-library/blocks/navigation-submenu/editor-rtl.css 296 B
build/block-library/blocks/navigation-submenu/editor.css 295 B
build/block-library/blocks/navigation/editor-rtl.css 2.26 kB
build/block-library/blocks/navigation/editor.css 2.26 kB
build/block-library/blocks/navigation/style-rtl.css 2.26 kB
build/block-library/blocks/navigation/style.css 2.25 kB
build/block-library/blocks/navigation/view.min.js 1.02 kB
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 377 B
build/block-library/blocks/page-list/editor.css 377 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 235 B
build/block-library/blocks/paragraph/editor.css 235 B
build/block-library/blocks/paragraph/style-rtl.css 335 B
build/block-library/blocks/paragraph/style.css 335 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 96 B
build/block-library/blocks/post-comments-form/editor.css 96 B
build/block-library/blocks/post-comments-form/style-rtl.css 508 B
build/block-library/blocks/post-comments-form/style.css 508 B
build/block-library/blocks/post-content/editor-rtl.css 74 B
build/block-library/blocks/post-content/editor.css 74 B
build/block-library/blocks/post-date/style-rtl.css 61 B
build/block-library/blocks/post-date/style.css 61 B
build/block-library/blocks/post-excerpt/editor-rtl.css 71 B
build/block-library/blocks/post-excerpt/editor.css 71 B
build/block-library/blocks/post-excerpt/style-rtl.css 141 B
build/block-library/blocks/post-excerpt/style.css 141 B
build/block-library/blocks/post-featured-image/editor-rtl.css 666 B
build/block-library/blocks/post-featured-image/editor.css 662 B
build/block-library/blocks/post-featured-image/style-rtl.css 342 B
build/block-library/blocks/post-featured-image/style.css 342 B
build/block-library/blocks/post-navigation-link/style-rtl.css 215 B
build/block-library/blocks/post-navigation-link/style.css 214 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 409 B
build/block-library/blocks/post-template/style.css 408 B
build/block-library/blocks/post-terms/style-rtl.css 96 B
build/block-library/blocks/post-terms/style.css 96 B
build/block-library/blocks/post-time-to-read/style-rtl.css 69 B
build/block-library/blocks/post-time-to-read/style.css 69 B
build/block-library/blocks/post-title/style-rtl.css 100 B
build/block-library/blocks/post-title/style.css 100 B
build/block-library/blocks/preformatted/style-rtl.css 125 B
build/block-library/blocks/preformatted/style.css 125 B
build/block-library/blocks/pullquote/editor-rtl.css 135 B
build/block-library/blocks/pullquote/editor.css 135 B
build/block-library/blocks/pullquote/style-rtl.css 354 B
build/block-library/blocks/pullquote/style.css 354 B
build/block-library/blocks/pullquote/theme-rtl.css 168 B
build/block-library/blocks/pullquote/theme.css 168 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 288 B
build/block-library/blocks/query-pagination/style.css 284 B
build/block-library/blocks/query-title/style-rtl.css 63 B
build/block-library/blocks/query-title/style.css 63 B
build/block-library/blocks/query/editor-rtl.css 486 B
build/block-library/blocks/query/editor.css 486 B
build/block-library/blocks/query/view.min.js 958 B
build/block-library/blocks/quote/style-rtl.css 237 B
build/block-library/blocks/quote/style.css 237 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 140 B
build/block-library/blocks/read-more/style.css 140 B
build/block-library/blocks/rss/editor-rtl.css 149 B
build/block-library/blocks/rss/editor.css 149 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 184 B
build/block-library/blocks/search/editor.css 184 B
build/block-library/blocks/search/style-rtl.css 629 B
build/block-library/blocks/search/style.css 628 B
build/block-library/blocks/search/theme-rtl.css 114 B
build/block-library/blocks/search/theme.css 114 B
build/block-library/blocks/search/view.min.js 478 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 229 B
build/block-library/blocks/separator/style.css 229 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 323 B
build/block-library/blocks/shortcode/editor.css 323 B
build/block-library/blocks/site-logo/editor-rtl.css 754 B
build/block-library/blocks/site-logo/editor.css 754 B
build/block-library/blocks/site-logo/style-rtl.css 204 B
build/block-library/blocks/site-logo/style.css 204 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 116 B
build/block-library/blocks/site-title/editor.css 116 B
build/block-library/blocks/site-title/style-rtl.css 57 B
build/block-library/blocks/site-title/style.css 57 B
build/block-library/blocks/social-link/editor-rtl.css 184 B
build/block-library/blocks/social-link/editor.css 184 B
build/block-library/blocks/social-links/editor-rtl.css 682 B
build/block-library/blocks/social-links/editor.css 681 B
build/block-library/blocks/spacer/editor-rtl.css 350 B
build/block-library/blocks/spacer/editor.css 350 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 395 B
build/block-library/blocks/table/editor.css 395 B
build/block-library/blocks/table/style-rtl.css 639 B
build/block-library/blocks/table/style.css 639 B
build/block-library/blocks/table/theme-rtl.css 146 B
build/block-library/blocks/table/theme.css 146 B
build/block-library/blocks/tag-cloud/style-rtl.css 251 B
build/block-library/blocks/tag-cloud/style.css 253 B
build/block-library/blocks/template-part/editor-rtl.css 403 B
build/block-library/blocks/template-part/editor.css 403 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/term-description/style-rtl.css 111 B
build/block-library/blocks/term-description/style.css 111 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 99 B
build/block-library/blocks/verse/style.css 99 B
build/block-library/blocks/video/editor-rtl.css 552 B
build/block-library/blocks/video/editor.css 555 B
build/block-library/blocks/video/style-rtl.css 185 B
build/block-library/blocks/video/style.css 185 B
build/block-library/blocks/video/theme-rtl.css 126 B
build/block-library/blocks/video/theme.css 126 B
build/block-library/classic-rtl.css 179 B
build/block-library/classic.css 179 B
build/block-library/common-rtl.css 1.11 kB
build/block-library/common.css 1.11 kB
build/block-library/editor-elements-rtl.css 75 B
build/block-library/editor-elements.css 75 B
build/block-library/elements-rtl.css 54 B
build/block-library/elements.css 54 B
build/block-library/reset-rtl.css 472 B
build/block-library/reset.css 472 B
build/block-library/theme-rtl.css 688 B
build/block-library/theme.css 693 B
build/block-serialization-default-parser/index.min.js 1.12 kB
build/block-serialization-spec-parser/index.min.js 2.87 kB
build/commands/index.min.js 15.6 kB
build/commands/style-rtl.css 935 B
build/commands/style.css 930 B
build/components/style-rtl.css 11.8 kB
build/compose/index.min.js 12.6 kB
build/core-commands/index.min.js 2.77 kB
build/core-data/index.min.js 72.8 kB
build/data-controls/index.min.js 640 B
build/data/index.min.js 8.95 kB
build/date/index.min.js 17.9 kB
build/deprecated/index.min.js 451 B
build/dom-ready/index.min.js 324 B
build/dom/index.min.js 4.65 kB
build/edit-post/classic-rtl.css 558 B
build/edit-post/classic.css 558 B
build/editor/style-rtl.css 5.34 kB
build/editor/style.css 5.33 kB
build/element/index.min.js 4.83 kB
build/escape-html/index.min.js 537 B
build/format-library/style-rtl.css 492 B
build/format-library/style.css 490 B
build/hooks/index.min.js 1.55 kB
build/html-entities/index.min.js 448 B
build/i18n/index.min.js 3.58 kB
build/interactivity/file.min.js 447 B
build/interactivity/image.min.js 1.67 kB
build/interactivity/navigation.min.js 1.15 kB
build/interactivity/query.min.js 740 B
build/interactivity/router.min.js 1.36 kB
build/interactivity/search.min.js 618 B
build/is-shallow-equal/index.min.js 527 B
build/keyboard-shortcuts/index.min.js 1.74 kB
build/keycodes/index.min.js 1.46 kB
build/list-reusable-blocks/index.min.js 2.11 kB
build/list-reusable-blocks/style-rtl.css 851 B
build/list-reusable-blocks/style.css 849 B
build/modules/importmap-polyfill.min.js 12.2 kB
build/notices/index.min.js 948 B
build/nux/index.min.js 2 kB
build/nux/style-rtl.css 747 B
build/nux/style.css 742 B
build/patterns/style-rtl.css 553 B
build/patterns/style.css 552 B
build/plugins/index.min.js 1.8 kB
build/preferences-persistence/index.min.js 2.05 kB
build/preferences/style-rtl.css 710 B
build/preferences/style.css 712 B
build/primitives/index.min.js 975 B
build/priority-queue/index.min.js 1.52 kB
build/private-apis/index.min.js 1 kB
build/react-i18n/index.min.js 623 B
build/react-refresh-entry/index.min.js 9.47 kB
build/react-refresh-runtime/index.min.js 6.78 kB
build/redux-routine/index.min.js 2.7 kB
build/reusable-blocks/index.min.js 2.72 kB
build/reusable-blocks/style-rtl.css 256 B
build/reusable-blocks/style.css 256 B
build/router/index.min.js 1.79 kB
build/server-side-render/index.min.js 1.95 kB
build/shortcode/index.min.js 1.39 kB
build/style-engine/index.min.js 2.1 kB
build/token-list/index.min.js 582 B
build/url/index.min.js 3.72 kB
build/vendors/inert-polyfill.min.js 2.48 kB
build/vendors/react-dom.min.js 41.8 kB
build/vendors/react.min.js 4.02 kB
build/viewport/index.min.js 957 B
build/warning/index.min.js 249 B
build/widgets/index.min.js 7.21 kB
build/widgets/style-rtl.css 1.17 kB
build/widgets/style.css 1.17 kB
build/wordcount/index.min.js 1.02 kB

compressed-size-action

Copy link
Contributor

@tellthemachines tellthemachines left a comment

Choose a reason for hiding this comment

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

Positioning the items is working really well! One thing that is starting to be bothersome is that we can't reset each property individually:
Screenshot 2024-03-01 at 11 45 08 am
My bad for not making it part of the initial implementation - it didn't seem like such an issue when all we had was Col and Row span, but it's definitely feeling off now. If you don't feel like adding a bunch of extra logic to this PR I'm happy to address it as a follow-up!

lib/block-supports/layout.php Outdated Show resolved Hide resolved
@noisysocks
Copy link
Member Author

Yeah true @tellthemachines it would be good to split them and I think have "Grid starts" hidden by default.

@tellthemachines
Copy link
Contributor

Just pushed a fix for an issue with columnStart in Auto mode, where once the column number goes below the start number, the grid will push the item into an auto column with no minimum size, and won't reflow gracefully:

Screenshot 2024-03-01 at 4 07 54 pm

I adjusted the existing container query so that, if a columnStart is present, once the number of columns goes below it the item will either span full-width if it also has a columnSpan or get reset if it doesn't. I think that's the best way to deal with it but open to other suggestions!

For Manual grids, should we be checking whether the columnStart is less than the columnCount? There can be unexpected effects if it goes over 😅

Had to rebase to avoid conflicts with 0b5cd48.

@noisysocks
Copy link
Member Author

For Manual grids, should we be checking whether the columnStart is less than the columnCount? There can be unexpected effects if it goes over 😅

Sounds good. Should we set max on the input? Or do we clamp the value before rendering it in CSS?

@tellthemachines
Copy link
Contributor

Should we set max on the input? Or do we clamp the value before rendering it in CSS?

I'm inlined towards setting on the input so it's clear to the users, instead of letting them set a value and then changing it.

@noisysocks
Copy link
Member Author

Oops forgot to git push yesterday. I've added a max to the inputs set to the number of columns when the layout is in manual mode.

@tellthemachines
Copy link
Contributor

I'm seeing the controls go all funny when grid is in Manual mode, can you repro this?
Screenshot 2024-03-05 at 11 19 29 am

@noisysocks
Copy link
Member Author

noisysocks commented Mar 5, 2024

I adjusted the existing container query so that, if a columnStart is present, once the number of columns goes below it the item will either span full-width if it also has a columnSpan or get reset if it doesn't. I think that's the best way to deal with it but open to other suggestions!

I tested this and it works as you describe.

I'm not sure about the behaviour though. I feel that in this case we can't possibly know what the user actually wants to do and so anything we do is a guess and will likely be unexpected.

Is it useful to set a start when the grid is in Auto mode? Maybe we make it so that column start / row start can only be set when the parent layout is a Manual grid? And then clamp the start values so that 1 ≤ start column/row ≤ num columns/rows?

I'm seeing the controls go all funny when grid is in Manual mode, can you repro this?

I'm not seeing this 😅

@tellthemachines
Copy link
Contributor

I'm not sure about the behaviour though. I feel that in this case we can't possibly know what the user actually wants to do and so anything we do is a guess and will likely be unexpected.

I think this responsive behaviour is less unexpected than what happens if we don't do anything 😅
When an item is set to a column-start that's bigger than the actual number of columns in the grid, the grid creates some auto-columns to fit it in the place it wants to be. But the auto-columns have no particular width by default, so they end up shrinking to the minimum possible size.

So let's say we have an auto grid with the black-and-white cat pic pinned to the 4th col:
Screenshot 2024-03-05 at 1 28 27 pm

With no responsiveness, if there's not enough space for a 4th col, the grid adds it all the same but makes it tiny:
Screenshot 2024-03-05 at 1 29 15 pm

Whereas with the container query, it looks a lot more sensible even if we did have to unpin the item:
Screenshot 2024-03-05 at 1 30 10 pm

I'm not super concerned with the unexpectedness because choosing an auto grid setting implies some level of giving up control on the exact position of things already 😅 so this is really just to ensure that no bad breakage occurs.

Setting the grid spans to 1 / -1 once the grid is too small for span number of cols assumes that if you're making an item span multiple columns you'll still want it to be bigger than the other items on smaller screens. That's a bit more of an assumption, but ultimately we do have to choose some default here and in testing that one seemed to work more gracefully than just plain resetting to auto.

Is it useful to set a start when the grid is in Auto mode? Maybe we make it so that column start / row start can only be set when the parent layout is a Manual grid? And then clamp the start values so that 1 ≤ start column/row ≤ num columns/rows?

I think it is still useful, for pinning items to the top for example.

@noisysocks
Copy link
Member Author

I merged #59488 into this. Easier I think to test both changes together as part of a cohesive update to the child layout controls.

@noisysocks
Copy link
Member Author

I also:

  • Updated the copy to Grid placement instead of Grid starts.
  • Made Grid placement off by default as it's more of an advanced use case.

// Check if columnSpan and columnStart are numbers so Math.max doesn't break.
const columnSpanNumber = columnSpan ? parseInt( columnSpan ) : null;
const columnStartNumber = columnStart
? parseInt( columnStart )
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a drive-by comment, do we need to check that parseInt was successful (i.e. an isNaN check or something similar to how parentColumnValue is checked), or can we always trust that if it was truthy, it'll be a number? Same with the line below.

Copy link
Contributor

Choose a reason for hiding this comment

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

If parseInt isn't successful it returns NaN, which will evaluate to false. Any other result should be a number 😅

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, gotcha. I noticed the value winds up being used directly in the calculation for containerQueryValue so wondered if there was a chance NaN could be unexpectedly output in the container query line? Not sure if that would ever be reached in practice, though, so feel free to ignore this comment for now!

@noisysocks
Copy link
Member Author

@tellthemachines and I were chatting and noted that one issue with letting one set Grid placement is that it doesn't update the DOM order which is not ideal for accessibility. We might need to update the block order when setting placement and set/reset the placement when re-ordering blocks using the movers.

Instead of trying to anticipate what the perfect solution is I've opted to put the UI for setting Grid placement behind the Grid interactivity experimental flag so that we can move forward with #59490 and continue to iterate.

Copy link
Contributor

@andrewserong andrewserong left a comment

Choose a reason for hiding this comment

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

This is generally testing well for me, but I noticed a couple of UI issues that would be good to tweak.

  • In the ToolsPanel menu, Padding appears between the two grid items in the menu. It'd be better for the two grid items to be next to each other.
image
  • The styling of the input fields appears to be off as they're not filling the available area:
image

Otherwise testing well, and the UI appears to be safely guarded behind the experiment flag. One potential idea could be to also display the UI in the inspector controls if a value is set but the experiment is switched off, so that if folks who aren't using the experiment encounter markup that has values set, it's possible to clear out values? That might not be necessary, though, so just an idea 🙂

@tellthemachines
Copy link
Contributor

The styling of the input fields appears to be off as they're not filling the available area

Oh, that's the same issue I was seeing last week! Only on the manual grid, right? But @noisysocks couldn't repro it.

@andrewserong
Copy link
Contributor

Only on the manual grid, right?

Yep, only on manual.

>
<InputControl
size={ '__unstable-large' }
label={ __( 'Column' ) }
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, just double-checking, should the visual label on these control also use the word placement, so that it matches the menu item?

Copy link
Contributor

Choose a reason for hiding this comment

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

It would make things clearer! It's a pretty long string, though I'm not sure how relevant that is given that strings can have any length in translation.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think it's necessary. Also if we say Column placement and Row placement the labels truncate as they're too long.

I suspect we'll change the labels (and lots of other things) based on user testing.

@noisysocks
Copy link
Member Author

The styling of the input fields appears to be off as they're not filling the available area

Oh, that's the same issue I was seeing last week! Only on the manual grid, right? But @noisysocks couldn't repro it.

Turns out this is webpack specific. It seems related to the max attribute on the <input> affecting the intrinsic width of the input.

https://stackoverflow.com/questions/33283901/input-number-max-attribute-resizes-field

I'm not sure how to fix this at the @wordpress/components level (adding width: fill-available as suggested above does not work) so instead I worked around the issue by giving an explicit width: 50% style to the flex items.

@noisysocks
Copy link
Member Author

  • In the ToolsPanel menu, Padding appears between the two grid items in the menu. It'd be better for the two grid items to be next to each other.

I agree but I'm not sure if it's possible? It looks like ToolsPanel will output all of the non-optional items and then all of the optional items, and each group is arranged in the order they're registered. We might need to adjust how ToolsPanel works but I don't want to do that in this PR.

Copy link
Contributor

@tellthemachines tellthemachines left a comment

Choose a reason for hiding this comment

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

Given this is an experiment, I think it's in a mergeable state now ✅

We will have to address the issue of matching visual and markup order before stabilising.

@noisysocks noisysocks enabled auto-merge (squash) March 14, 2024 01:35
@noisysocks noisysocks merged commit 9c213e9 into trunk Mar 14, 2024
58 checks passed
@noisysocks noisysocks deleted the add/grid-column-and-row-start branch March 14, 2024 02:05
@github-actions github-actions bot added this to the Gutenberg 18.0 milestone Mar 14, 2024
carstingaxion pushed a commit to carstingaxion/gutenberg that referenced this pull request Mar 27, 2024
…9483)

* Separate flex child controls so each has its own reset.

* Output grid-start styling

* Add Column Start and Row Start controls to block inspector

* Simplify php array access

* Remove a few more issets

* Adjust container query to take columnStart into account.

* Reset grid spans together

* Add max to column/row inputs

* Adjust copy

* Don't show Grid position by default

* Use 'Grid placement'

* Simplify input control labels for now

* Put placement behind the Grid interactivity experimental flag for now

* Fix input width issue in webkit

* Show placement after span

---------

Co-authored-by: tellthemachines <isabel@tellthemachines.com>

Co-authored-by: tellthemachines <isabel_brison@git.wordpress.org>
Co-authored-by: noisysocks <noisysocks@git.wordpress.org>
Co-authored-by: andrewserong <andrewserong@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Layout Layout block support, its UI controls, and style output. [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants