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

Background image: move controls into a popover #60151

Merged
merged 11 commits into from
Jul 3, 2024

Conversation

ramonjd
Copy link
Member

@ramonjd ramonjd commented Mar 25, 2024

What?

This PR:

  1. moves the background controls into a flyout panel
  2. consolidates properties in the tool panel beneath the "background image" property, which means that resetting an image will reset all associated properties

See:

Doing this with a view to consolidate colors and fill. See: #60100 (comment)

Also take into account:

TODO

  • Refactor main components in packages/block-editor/src/components/global-styles/background-panel.js
  • Condense and consolidate controls in the popover
  • Mobile view - ensure it works as expected.
  • Test keyboard interaction
  • Wire in tools panel reset for individual properties? E.g., position and repeat?

Why?

To win back space in the sidebar controls.

How?

Moving background image controls into a flyout popover. This includes, where an image exists, the media select control.

To get the Tools Panel controls to work, I've created an invisible ToolsPanelItem components for each control set - this registers reset callbacks and so on in the Tools Panel.

Testing Instructions

The flyout appears in the Global styles (Layout > Background Image) and at the block level for Group, Quote, Post Content blocks. For both:

  1. Check that you add/upload/reset background images from the sidebar panel.
  2. When a background image is selected, the sidebar control activates the flyout.
  3. The controls the flyout should update the background image properties as expected
  4. Ensure the Tools Panel controls works, that is, everything should open, close and reset.
  5. In mobile view (< 782px) check that the flyout appears in the viewport width.
  6. Resetting the image should also reset size, position, and repeat.

Testing Instructions for Keyboard

Check:

  1. You can tab through the sidebar controls, and add a background image
  2. . Where a background image exists, check you can tab to the background image control and hit Enter to open and focus the new flyout.
  3. . Tab through the flyout and change the background image properties

Screenshots or screencast

Global styles Blocks
Screenshot 2024-06-27 at 11 47 29 AM Screenshot 2024-06-27 at 11 48 01 AM

Resetting background properties:

2024-06-28.10.20.00.mp4

Related

@ramonjd ramonjd added [Type] Enhancement A suggestion for improvement. [Status] In Progress Tracking issues with work in progress labels Mar 25, 2024
@ramonjd ramonjd self-assigned this Mar 25, 2024
Copy link

github-actions bot commented Mar 25, 2024

Size Change: +723 B (+0.04%)

Total Size: 1.75 MB

Filename Size Change
build/block-editor/index.min.js 252 kB +279 B (+0.11%)
build/block-editor/style-rtl.css 15.9 kB +250 B (+1.59%)
build/block-editor/style.css 15.9 kB +250 B (+1.59%)
build/edit-site/index.min.js 208 kB -56 B (-0.03%)
ℹ️ View Unchanged
Filename Size
build/a11y/index.min.js 951 B
build/annotations/index.min.js 2.26 kB
build/api-fetch/index.min.js 2.31 kB
build/autop/index.min.js 2.12 kB
build/blob/index.min.js 579 B
build/block-directory/index.min.js 7.31 kB
build/block-directory/style-rtl.css 1.01 kB
build/block-directory/style.css 1.01 kB
build/block-editor/content-rtl.css 4.58 kB
build/block-editor/content.css 4.58 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 149 B
build/block-library/blocks/audio/editor.css 151 B
build/block-library/blocks/audio/style-rtl.css 132 B
build/block-library/blocks/audio/style.css 132 B
build/block-library/blocks/audio/theme-rtl.css 134 B
build/block-library/blocks/audio/theme.css 134 B
build/block-library/blocks/avatar/editor-rtl.css 115 B
build/block-library/blocks/avatar/editor.css 115 B
build/block-library/blocks/avatar/style-rtl.css 104 B
build/block-library/blocks/avatar/style.css 104 B
build/block-library/blocks/button/editor-rtl.css 310 B
build/block-library/blocks/button/editor.css 310 B
build/block-library/blocks/button/style-rtl.css 538 B
build/block-library/blocks/button/style.css 538 B
build/block-library/blocks/buttons/editor-rtl.css 336 B
build/block-library/blocks/buttons/editor.css 336 B
build/block-library/blocks/buttons/style-rtl.css 328 B
build/block-library/blocks/buttons/style.css 328 B
build/block-library/blocks/calendar/style-rtl.css 240 B
build/block-library/blocks/calendar/style.css 240 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 122 B
build/block-library/blocks/code/theme.css 122 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 420 B
build/block-library/blocks/columns/style.css 420 B
build/block-library/blocks/comment-author-avatar/editor-rtl.css 124 B
build/block-library/blocks/comment-author-avatar/editor.css 124 B
build/block-library/blocks/comment-content/style-rtl.css 90 B
build/block-library/blocks/comment-content/style.css 90 B
build/block-library/blocks/comment-template/style-rtl.css 200 B
build/block-library/blocks/comment-template/style.css 199 B
build/block-library/blocks/comments-pagination-numbers/editor-rtl.css 122 B
build/block-library/blocks/comments-pagination-numbers/editor.css 121 B
build/block-library/blocks/comments-pagination/editor-rtl.css 221 B
build/block-library/blocks/comments-pagination/editor.css 211 B
build/block-library/blocks/comments-pagination/style-rtl.css 234 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 832 B
build/block-library/blocks/comments/editor.css 832 B
build/block-library/blocks/comments/style-rtl.css 632 B
build/block-library/blocks/comments/style.css 631 B
build/block-library/blocks/cover/editor-rtl.css 668 B
build/block-library/blocks/cover/editor.css 669 B
build/block-library/blocks/cover/style-rtl.css 1.62 kB
build/block-library/blocks/cover/style.css 1.6 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 86 B
build/block-library/blocks/details/style.css 86 B
build/block-library/blocks/embed/editor-rtl.css 314 B
build/block-library/blocks/embed/editor.css 314 B
build/block-library/blocks/embed/style-rtl.css 419 B
build/block-library/blocks/embed/style.css 419 B
build/block-library/blocks/embed/theme-rtl.css 133 B
build/block-library/blocks/embed/theme.css 133 B
build/block-library/blocks/file/editor-rtl.css 326 B
build/block-library/blocks/file/editor.css 326 B
build/block-library/blocks/file/style-rtl.css 278 B
build/block-library/blocks/file/style.css 279 B
build/block-library/blocks/file/view.min.js 324 B
build/block-library/blocks/footnotes/style-rtl.css 198 B
build/block-library/blocks/footnotes/style.css 197 B
build/block-library/blocks/form-input/editor-rtl.css 229 B
build/block-library/blocks/form-input/editor.css 229 B
build/block-library/blocks/form-input/style-rtl.css 342 B
build/block-library/blocks/form-input/style.css 342 B
build/block-library/blocks/form-submission-notification/editor-rtl.css 344 B
build/block-library/blocks/form-submission-notification/editor.css 341 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 470 B
build/block-library/blocks/freeform/editor-rtl.css 2.6 kB
build/block-library/blocks/freeform/editor.css 2.6 kB
build/block-library/blocks/gallery/editor-rtl.css 958 B
build/block-library/blocks/gallery/editor.css 962 B
build/block-library/blocks/gallery/style-rtl.css 1.71 kB
build/block-library/blocks/gallery/style.css 1.71 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 402 B
build/block-library/blocks/group/editor.css 402 B
build/block-library/blocks/group/style-rtl.css 103 B
build/block-library/blocks/group/style.css 103 B
build/block-library/blocks/group/theme-rtl.css 79 B
build/block-library/blocks/group/theme.css 79 B
build/block-library/blocks/heading/style-rtl.css 188 B
build/block-library/blocks/heading/style.css 188 B
build/block-library/blocks/html/editor-rtl.css 346 B
build/block-library/blocks/html/editor.css 347 B
build/block-library/blocks/image/editor-rtl.css 845 B
build/block-library/blocks/image/editor.css 843 B
build/block-library/blocks/image/style-rtl.css 1.54 kB
build/block-library/blocks/image/style.css 1.54 kB
build/block-library/blocks/image/theme-rtl.css 137 B
build/block-library/blocks/image/theme.css 137 B
build/block-library/blocks/image/view.min.js 1.54 kB
build/block-library/blocks/latest-comments/style-rtl.css 355 B
build/block-library/blocks/latest-comments/style.css 354 B
build/block-library/blocks/latest-posts/editor-rtl.css 204 B
build/block-library/blocks/latest-posts/editor.css 204 B
build/block-library/blocks/latest-posts/style-rtl.css 509 B
build/block-library/blocks/latest-posts/style.css 510 B
build/block-library/blocks/list/style-rtl.css 104 B
build/block-library/blocks/list/style.css 104 B
build/block-library/blocks/media-text/editor-rtl.css 304 B
build/block-library/blocks/media-text/editor.css 303 B
build/block-library/blocks/media-text/style-rtl.css 516 B
build/block-library/blocks/media-text/style.css 515 B
build/block-library/blocks/more/editor-rtl.css 427 B
build/block-library/blocks/more/editor.css 427 B
build/block-library/blocks/navigation-link/editor-rtl.css 663 B
build/block-library/blocks/navigation-link/editor.css 664 B
build/block-library/blocks/navigation-link/style-rtl.css 192 B
build/block-library/blocks/navigation-link/style.css 191 B
build/block-library/blocks/navigation-submenu/editor-rtl.css 295 B
build/block-library/blocks/navigation-submenu/editor.css 294 B
build/block-library/blocks/navigation/editor-rtl.css 2.2 kB
build/block-library/blocks/navigation/editor.css 2.21 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.03 kB
build/block-library/blocks/nextpage/editor-rtl.css 392 B
build/block-library/blocks/nextpage/editor.css 392 B
build/block-library/blocks/page-list/editor-rtl.css 378 B
build/block-library/blocks/page-list/editor.css 378 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 236 B
build/block-library/blocks/paragraph/editor.css 236 B
build/block-library/blocks/paragraph/style-rtl.css 341 B
build/block-library/blocks/paragraph/style.css 340 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 506 B
build/block-library/blocks/post-comments-form/style.css 506 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 62 B
build/block-library/blocks/post-date/style.css 62 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 729 B
build/block-library/blocks/post-featured-image/editor.css 726 B
build/block-library/blocks/post-featured-image/style-rtl.css 341 B
build/block-library/blocks/post-featured-image/style.css 341 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 399 B
build/block-library/blocks/post-template/style.css 398 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 70 B
build/block-library/blocks/post-time-to-read/style.css 70 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 134 B
build/block-library/blocks/pullquote/editor.css 134 B
build/block-library/blocks/pullquote/style-rtl.css 342 B
build/block-library/blocks/pullquote/style.css 342 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 121 B
build/block-library/blocks/query-pagination-numbers/editor.css 118 B
build/block-library/blocks/query-pagination/editor-rtl.css 220 B
build/block-library/blocks/query-pagination/editor.css 208 B
build/block-library/blocks/query-pagination/style-rtl.css 287 B
build/block-library/blocks/query-pagination/style.css 283 B
build/block-library/blocks/query-title/style-rtl.css 64 B
build/block-library/blocks/query-title/style.css 64 B
build/block-library/blocks/query/editor-rtl.css 502 B
build/block-library/blocks/query/editor.css 502 B
build/block-library/blocks/query/view.min.js 958 B
build/block-library/blocks/quote/style-rtl.css 238 B
build/block-library/blocks/quote/style.css 238 B
build/block-library/blocks/quote/theme-rtl.css 221 B
build/block-library/blocks/quote/theme.css 225 B
build/block-library/blocks/read-more/style-rtl.css 138 B
build/block-library/blocks/read-more/style.css 138 B
build/block-library/blocks/rss/editor-rtl.css 101 B
build/block-library/blocks/rss/editor.css 101 B
build/block-library/blocks/rss/style-rtl.css 288 B
build/block-library/blocks/rss/style.css 287 B
build/block-library/blocks/search/editor-rtl.css 183 B
build/block-library/blocks/search/editor.css 183 B
build/block-library/blocks/search/style-rtl.css 672 B
build/block-library/blocks/search/style.css 671 B
build/block-library/blocks/search/theme-rtl.css 113 B
build/block-library/blocks/search/theme.css 113 B
build/block-library/blocks/search/view.min.js 475 B
build/block-library/blocks/separator/editor-rtl.css 100 B
build/block-library/blocks/separator/editor.css 100 B
build/block-library/blocks/separator/style-rtl.css 248 B
build/block-library/blocks/separator/style.css 248 B
build/block-library/blocks/separator/theme-rtl.css 195 B
build/block-library/blocks/separator/theme.css 195 B
build/block-library/blocks/shortcode/editor-rtl.css 286 B
build/block-library/blocks/shortcode/editor.css 286 B
build/block-library/blocks/site-logo/editor-rtl.css 806 B
build/block-library/blocks/site-logo/editor.css 803 B
build/block-library/blocks/site-logo/style-rtl.css 218 B
build/block-library/blocks/site-logo/style.css 218 B
build/block-library/blocks/site-tagline/editor-rtl.css 87 B
build/block-library/blocks/site-tagline/editor.css 87 B
build/block-library/blocks/site-title/editor-rtl.css 123 B
build/block-library/blocks/site-title/editor.css 123 B
build/block-library/blocks/site-title/style-rtl.css 71 B
build/block-library/blocks/site-title/style.css 71 B
build/block-library/blocks/social-link/editor-rtl.css 338 B
build/block-library/blocks/social-link/editor.css 338 B
build/block-library/blocks/social-links/editor-rtl.css 676 B
build/block-library/blocks/social-links/editor.css 675 B
build/block-library/blocks/social-links/style-rtl.css 1.51 kB
build/block-library/blocks/social-links/style.css 1.5 kB
build/block-library/blocks/spacer/editor-rtl.css 346 B
build/block-library/blocks/spacer/editor.css 346 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 394 B
build/block-library/blocks/table/editor.css 394 B
build/block-library/blocks/table/style-rtl.css 640 B
build/block-library/blocks/table/style.css 639 B
build/block-library/blocks/table/theme-rtl.css 152 B
build/block-library/blocks/table/theme.css 152 B
build/block-library/blocks/tag-cloud/style-rtl.css 266 B
build/block-library/blocks/tag-cloud/style.css 265 B
build/block-library/blocks/template-part/editor-rtl.css 393 B
build/block-library/blocks/template-part/editor.css 393 B
build/block-library/blocks/template-part/theme-rtl.css 113 B
build/block-library/blocks/template-part/theme.css 113 B
build/block-library/blocks/term-description/style-rtl.css 108 B
build/block-library/blocks/term-description/style.css 108 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 165 B
build/block-library/blocks/text-columns/style.css 165 B
build/block-library/blocks/verse/style-rtl.css 98 B
build/block-library/blocks/verse/style.css 98 B
build/block-library/blocks/video/editor-rtl.css 553 B
build/block-library/blocks/video/editor.css 554 B
build/block-library/blocks/video/style-rtl.css 192 B
build/block-library/blocks/video/style.css 192 B
build/block-library/blocks/video/theme-rtl.css 134 B
build/block-library/blocks/video/theme.css 134 B
build/block-library/classic-rtl.css 179 B
build/block-library/classic.css 179 B
build/block-library/common-rtl.css 1.1 kB
build/block-library/common.css 1.1 kB
build/block-library/editor-elements-rtl.css 75 B
build/block-library/editor-elements.css 75 B
build/block-library/editor-rtl.css 11.9 kB
build/block-library/editor.css 11.9 kB
build/block-library/elements-rtl.css 54 B
build/block-library/elements.css 54 B
build/block-library/index.min.js 219 kB
build/block-library/reset-rtl.css 472 B
build/block-library/reset.css 472 B
build/block-library/style-rtl.css 14.6 kB
build/block-library/style.css 14.6 kB
build/block-library/theme-rtl.css 702 B
build/block-library/theme.css 707 B
build/block-serialization-default-parser/index.min.js 1.12 kB
build/block-serialization-spec-parser/index.min.js 2.87 kB
build/blocks/index.min.js 52.2 kB
build/commands/index.min.js 15.2 kB
build/commands/style-rtl.css 955 B
build/commands/style.css 952 B
build/components/index.min.js 223 kB
build/components/style-rtl.css 12.1 kB
build/components/style.css 12.1 kB
build/compose/index.min.js 12.9 kB
build/core-commands/index.min.js 2.77 kB
build/core-data/index.min.js 72.6 kB
build/customize-widgets/index.min.js 10.9 kB
build/customize-widgets/style-rtl.css 1.35 kB
build/customize-widgets/style.css 1.35 kB
build/data-controls/index.min.js 641 B
build/data/index.min.js 8.98 kB
build/date/index.min.js 18 kB
build/deprecated/index.min.js 458 B
build/dom-ready/index.min.js 325 B
build/dom/index.min.js 4.65 kB
build/edit-post/classic-rtl.css 578 B
build/edit-post/classic.css 580 B
build/edit-post/index.min.js 12.5 kB
build/edit-post/style-rtl.css 2.34 kB
build/edit-post/style.css 2.33 kB
build/edit-site/posts-rtl.css 6.54 kB
build/edit-site/posts.css 6.54 kB
build/edit-site/style-rtl.css 11.7 kB
build/edit-site/style.css 11.7 kB
build/edit-widgets/index.min.js 17.6 kB
build/edit-widgets/style-rtl.css 4.18 kB
build/edit-widgets/style.css 4.18 kB
build/editor/index.min.js 98.2 kB
build/editor/style-rtl.css 9.15 kB
build/editor/style.css 9.15 kB
build/element/index.min.js 4.83 kB
build/escape-html/index.min.js 537 B
build/format-library/index.min.js 8.07 kB
build/format-library/style-rtl.css 494 B
build/format-library/style.css 493 B
build/hooks/index.min.js 1.54 kB
build/html-entities/index.min.js 445 B
build/i18n/index.min.js 3.58 kB
build/interactivity/debug.min.js 16.5 kB
build/interactivity/file.min.js 447 B
build/interactivity/image.min.js 1.68 kB
build/interactivity/index.min.js 13.4 kB
build/interactivity/navigation.min.js 1.16 kB
build/interactivity/query.min.js 742 B
build/interactivity/router.min.js 2.8 kB
build/interactivity/search.min.js 615 B
build/is-shallow-equal/index.min.js 526 B
build/keyboard-shortcuts/index.min.js 1.31 kB
build/keycodes/index.min.js 1.46 kB
build/list-reusable-blocks/index.min.js 2.17 kB
build/list-reusable-blocks/style-rtl.css 846 B
build/list-reusable-blocks/style.css 846 B
build/media-utils/index.min.js 2.92 kB
build/modules/importmap-polyfill.min.js 12.3 kB
build/notices/index.min.js 946 B
build/nux/index.min.js 1.58 kB
build/nux/style-rtl.css 749 B
build/nux/style.css 745 B
build/patterns/index.min.js 7.35 kB
build/patterns/style-rtl.css 687 B
build/patterns/style.css 685 B
build/plugins/index.min.js 1.81 kB
build/preferences-persistence/index.min.js 2.06 kB
build/preferences/index.min.js 2.9 kB
build/preferences/style-rtl.css 578 B
build/preferences/style.css 578 B
build/primitives/index.min.js 829 B
build/priority-queue/index.min.js 1.54 kB
build/private-apis/index.min.js 1.01 kB
build/react-i18n/index.min.js 630 B
build/react-refresh-entry/index.min.js 9.47 kB
build/react-refresh-runtime/index.min.js 6.76 kB
build/redux-routine/index.min.js 2.69 kB
build/reusable-blocks/index.min.js 2.73 kB
build/reusable-blocks/style-rtl.css 256 B
build/reusable-blocks/style.css 256 B
build/rich-text/index.min.js 10.1 kB
build/router/index.min.js 1.96 kB
build/server-side-render/index.min.js 1.94 kB
build/shortcode/index.min.js 1.4 kB
build/style-engine/index.min.js 2.01 kB
build/token-list/index.min.js 581 B
build/url/index.min.js 3.85 kB
build/vendors/react-dom.min.js 42.8 kB
build/vendors/react-jsx-runtime.min.js 560 B
build/vendors/react.min.js 2.65 kB
build/viewport/index.min.js 965 B
build/warning/index.min.js 250 B
build/widgets/index.min.js 7.19 kB
build/widgets/style-rtl.css 1.16 kB
build/widgets/style.css 1.16 kB
build/wordcount/index.min.js 1.03 kB

compressed-size-action

@ramonjd ramonjd force-pushed the add/background-global-styles-panel branch from b09f29e to 653d32a Compare March 26, 2024 03:32
Base automatically changed from add/background-global-styles-panel to trunk March 27, 2024 04:47
@ramonjd ramonjd force-pushed the try/background-image-control-refactor branch from 77235c5 to 4e1c637 Compare March 28, 2024 04:37
@ramonjd
Copy link
Member Author

ramonjd commented Mar 28, 2024

Notes:

There's a bit of a blocker on this particular design since I'm not sure I can integrate tools panel functionality (show by default / reset) with the popover contents.

The tools panel registers rendered tools panel items. Given that the background controls are in the dropdown popover, the items aren't rendered and so the tools panel ellipsis menus don't appear.

I've tried adding a "dummy" ToolsPanelItem in the DOM. It kinda works, but it's not consistent with other block supports and style options. Furthermore, it breaks the block supports __experimentalDefaultControls.

focusable={ false }
className="block-editor-global-styles-background-panel__tab-panel"
>
<FocalPointPicker
Copy link
Member Author

@ramonjd ramonjd Jun 20, 2024

Choose a reason for hiding this comment

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

One thing to note about the focal point picker is that its dimensions vary - it can be very tall or short depending on the image. This is whether it's in a popover or not, but it affect the popover height and scroll.

A tall image:

2024-06-20.15.26.45.mp4

Constraining it via max-height doesn't make the tool any more usable:

Screenshot 2024-06-20 at 3 30 20 PM
@jasmussen
Copy link
Contributor

Nice work. Took a stab at some designs in this Figma. The main thing I wanted to address was to illustrate the idea of just moving the entire background image panel inside the flyout. That might also address the split behavior of this one, which doesn't feel as ergonomic as it could:
status

Here are the results, but note that they should be thought of as in a draft state. @jameskoster shared some ideas that went in a different direction on another of these issues, and I'd like him to have a chance to chime in, and perhaps remix the figma pieces.

Group block with no background image:

Group block with no background image

Note how even the "Add background image" button was moved inside the flyout.

Group block with a background image:

Group block with background image

The flyout essentially contain the contents of the panel, including tiling and position options. I didn't see a clear need for tabs yet, but as noted, Jay had some thoughts too that I wanted to give him a chance to illustrate.

Additional note, this mockup tries a different design for the background image "swatch"—instead of being a circle, it is here, a square, to better match what we are showing in the List View for images, etc.

@jameskoster
Copy link
Contributor

Note how even the "Add background image" button was moved inside the flyout.

This feels a bit of a drawback since it's adding a click. When there's no image set, could the button open the media library directly? There are options to upload or select an image there.

Group block with a background image

This mockup seems like a good direction for now. We're just missing controls to replace or unset the background image.

For unsetting there are a couple of existing patterns to consider:

Clearing a color Removing a shadow
Screenshot 2024-06-20 at 11 49 13 Screenshot 2024-06-20 at 11 54 17

Having a 'Clear' button in the popover might be strange to use, because clicking it would hide all the other settings. For that reason I prefer the latter. It also makes unsetting require one less click.

Replacing is slightly tricker. It's probably okay to place this affordance in the popover, perhaps as an Item which opens the Media Library on click?

Screenshot 2024-06-20 at 12 48 31
@jasmussen
Copy link
Contributor

The minus to unset is a great argument for making this follow the ItemGroup pattern. And feel free to see if we can keep the "Add background image" CTA right in the Item itself. But we need some way to then "replace" from inside the flyout, it probably shouldn't be that recycle button.

@ramonjd
Copy link
Member Author

ramonjd commented Jun 21, 2024

Thanks for the continued support on this @jasmussen and @jameskoster

Also for the Figma link, it helps a lot!

Note how even the "Add background image" button was moved inside the flyout.

This feels a bit of a drawback since it's adding a click. When there's no image set, could the button open the media library directly? There are options to upload or select an image there.

This is very doable. So,

  1. Where no image is set, the button has the select/upload dropdown menu
  2. Where an image is set, the preview icon is shown on the button, and the flyout appears. The media library controls are now in the flyout as per the design above?

I'll try it out in the next iteration.

As mentioned over at #60100 (comment) it'd be nice to get the flyout/refactor done first and then work on relocating the background controls, e.g., in Color and Fill. These PRs get very chunky very quickly 😄

@jasmussen
Copy link
Contributor

Took a stab at an i3 that incorporates the conversation of the reset button being added, and the initial state simply opening the media library. It's not quite working so well:

Background image tools

I still think these are the right ingredients, with the majority of work happening in the modal. But there's something here that isn't connecting, and it's all related to @jameskoster's excellent observations here.

The short is, I still think we probably want this panel to live in a flyout. But probably it's good to establish first: where does the button live? Jay, let me know if this inspires any ideas.

@jameskoster
Copy link
Contributor

In the short/medium term I don't mind putting the button in the Color (& Fill) panel. I also wouldn't mind leaving the Background Image panel and placing it there. I think both provide a pathway to a dedicated 'Background' or 'Fill' panel in the future, once we've fully explored that idea.

@ramonjd
Copy link
Member Author

ramonjd commented Jun 25, 2024

Testing out moving the media replace flow to the flyout panel:

Kapture.2024-06-25.at.12.41.44.mp4

A couple of janky issues, mainly the popover has a z-index of 1000000 😱 so it sits on top of the media library:

Screenshot 2024-06-25 at 12 43 22 PM

My instinct tells me the media library should always sit on top of everything, so bumping its z-index could work. The tricker path is closing the background image controls panel when the media library is open.

@andrewserong
Copy link
Contributor

Looks promising, though!

My instinct tells me the media library should always sit on top of everything, so bumping its z-index could work.

It seems we're doing that for a bunch of other modals, so sounds like it could be a good approach?

// Should be above the popover (dropdown)
".reusable-blocks-menu-items__convert-modal": 1000001,
".patterns-menu-items__convert-modal": 1000001,
".editor-create-template-part-modal": 1000001,
".block-editor-block-lock-modal": 1000001,
".block-editor-template-part__selection-modal": 1000001,
".block-editor-block-rename-modal": 1000001,
".edit-site-list__rename-modal": 1000001,
".dataviews-action-modal": 1000001,
".editor-action-modal": 1000001,
".editor-post-template__swap-template-modal": 1000001,
".edit-site-template-panel__replace-template-modal": 1000001,

@ramonjd ramonjd force-pushed the try/background-image-control-refactor branch from f27323c to cab0f46 Compare June 25, 2024 02:56
@ramonjd ramonjd force-pushed the try/background-image-control-refactor branch from 94186e1 to 6495425 Compare July 2, 2024 03:59
@ramonjd
Copy link
Member Author

ramonjd commented Jul 2, 2024

The squishening!

Desktop Mobile
Screenshot 2024-07-02 at 1 26 16 PM Screenshot 2024-07-02 at 1 27 35 PM
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.

Great work @ramonjd, and thanks for the guidance @jameskoster!

This is testing very nicely for me now:

✅ The position of the popover feels stable when toggling between sizes, thanks to the disabled fields
✅ The focal point position area no longer takes up very much room, making the controls feel more contained
✅ On smaller screen sizes (like my laptop screen) the popover feels reasonably sized and doesn't display a scrollbar

2024-07-02.15.12.25.mp4

Overall this very much crosses the threshold for me of feeling much nicer to use than what we have on trunk. In terms of the fixed height of the focal point picker I wonder if we could afford to give it a little more room potentially, but I reckon at this stage it'd be best to leave further tweaking to follow-ups since this is a pretty decent sized change in its current form.

Might be worth seeing what the designers think before landing, but overall this LGTM! Just left a tiny nit of a code comment that can be removed before merge.

🚀

@andrewserong andrewserong added the [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi label Jul 2, 2024
@jameskoster
Copy link
Contributor

I wonder if we could afford to give it a little more room potentially

I had the same thought. As a small tweak, could the height scale based on viewport height?

It would be really great if we could use the same unit control as you can see in the Padding setting here:

Screenshot 2024-07-02 at 16 07 56

The 'Size' segmented control should also use the new 40px sizing (__next40pxDefaultSize).

With these changes I think we're good to go :)

@ramonjd
Copy link
Member Author

ramonjd commented Jul 2, 2024

The 'Size' segmented control should also use the new 40px sizing (__next40pxDefaultSize).

I'll revert back, but note that removing __next40pxDefaultSize provides much of the space saving.

I wonder if we could afford to give it a little more room potentially

I had the same thought. As a small tweak, could the height scale based on viewport height?

I did try vh with various image sizes, but it's a bit hit and miss. I'll try to land on a value. We can always change it later.

Regardless, I think we're in a good place to iterate.

I'll fix the above issues and merge.

Thanks again for all the help!

ramonjd added 11 commits July 3, 2024 10:21
Refactor the media toggle button and refactor controls
Temp. don't send default controls in hook
A bit of margin
Reset image functions reset all background image properties.

isShownByDefault prop not used. Deleting

Prevent focal point picker creating horizontal scroll

Expand popover on mobile
Don't resize with window height change
Squishing all the controls, including giving the focal point picker a max-height
Ensure long file names are not cut off by min-width
Use clamp value for focal picker image height
@ramonjd ramonjd force-pushed the try/background-image-control-refactor branch from b25d3db to 34d20ce Compare July 3, 2024 00:21
@ramonjd
Copy link
Member Author

ramonjd commented Jul 3, 2024

Okay! I think I've come up with a good compromise by using a clamp value for the focal picker image height. It can be tweaked later if needed.

Screenshot 2024-07-03 at 10 04 43 AM Screenshot 2024-07-03 at 10 04 55 AM Screenshot 2024-07-03 at 10 05 03 AM
@ramonjd ramonjd enabled auto-merge (squash) July 3, 2024 00:26
@andrewserong
Copy link
Contributor

I think I've come up with a good compromise by using a clamp value for the focal picker image height.

Nice one! 🚀

@ramonjd ramonjd merged commit 8cef57c into trunk Jul 3, 2024
61 checks passed
@ramonjd ramonjd deleted the try/background-image-control-refactor branch July 3, 2024 00:59
@github-actions github-actions bot added this to the Gutenberg 18.8 milestone Jul 3, 2024
@jasmussen
Copy link
Contributor

I'll revert back, but note that removing __next40pxDefaultSize provides much of the space saving.

Just wanted to comment on this, the default size is 36px, and should ideally be avoided (see #46734) in favor of a taller and more legible 40px default, or exactly for space-saving concerns the more compact 32px.

carstingaxion pushed a commit to carstingaxion/gutenberg that referenced this pull request Jul 18, 2024
* Testing other component layout and dummy toolspanel items
Refactor the media toggle button and refactor controls
Temp. don't send default controls in hook

* Rejigging components, catering for no-background-image-controls

* With tabs

A bit of margin

* Revert tabs and move the image upload to the floating panel

* Temp hack to push popover into the background

* Fix hack to push popover into the background

* Tweak size of media flow dropdown
Icon margin tweak

* Remove default controls override as there's only 'background image' now.
Reset image functions reset all background image properties.

isShownByDefault prop not used. Deleting

Prevent focal point picker creating horizontal scroll

Expand popover on mobile
Don't resize with window height change

* Rolling back expanding popover in mobile.
Squishing all the controls, including giving the focal point picker a max-height

* Remove commented-out code

* Revert input sizes
Ensure long file names are not cut off by min-width
Use clamp value for focal picker image height

Unlinked contributors: brentjett.

Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
Co-authored-by: andrewserong <andrewserong@git.wordpress.org>
Co-authored-by: jasmussen <joen@git.wordpress.org>
Co-authored-by: jameskoster <jameskoster@git.wordpress.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi Global Styles Anything related to the broader Global Styles efforts, including Styles Engine and theme.json [Type] Enhancement A suggestion for improvement.
5 participants