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

Border Controls: Update control components to allow 40px height #41860

Merged
merged 31 commits into from
Oct 26, 2022

Conversation

aaronrobertshaw
Copy link
Contributor

Related:

What?

Adds the ability for the BorderControl, BorderBoxControl, and BorderRadiusControl components to be displayed with a 40px height.

At this stage, this PR does not toggle the display of border controls to 40px by default. If we wish to make these controls that height straight away we can close this PR in favor of more straightforward tweaks.

Why?

The current design direction for new tools / controls is to have a 40px default height.

How?

  • Replaces the __next36pxDefaultSize prop for the BorderControl and BorderBoxControl components with __next40pxDefaultSize
  • Updates the BorderRadiusControl to accept a new __next40pxDefaultSize prop
  • Uses the __next40pxDefaultSize props to make each component display with a 40px height
  • The BorderRadiusControl leverages the size prop of its inner UnitControl/InputControl to make its input 40px.

Testing Instructions

  1. After checking out this PR, edit a post, add a Group block, and select it
  2. Within the inspector controls sidebar the border controls should still be displayed within a 30px height
  3. Switch to the site editor and within the Global Styles panel navigate to Blocks > Group > Layout
  4. Confirm the border controls are still 30px
  5. Apply the patch below to toggle on the 40px height for border controls
  6. Ensure the border controls in both editors are now 40px high and all inner components are positioned correctly
Diff to toggle on 40px height
diff --git a/packages/block-editor/src/hooks/border-radius.js b/packages/block-editor/src/hooks/border-radius.js
index fa61bafa92..f062373a19 100644
--- a/packages/block-editor/src/hooks/border-radius.js
+++ b/packages/block-editor/src/hooks/border-radius.js
@@ -38,6 +38,7 @@ export function BorderRadiusEdit( props ) {
 		<BorderRadiusControl
 			values={ style?.border?.radius }
 			onChange={ onChange }
+			__next40pxDefaultSize={ true }
 		/>
 	);
 }
diff --git a/packages/block-editor/src/hooks/border.js b/packages/block-editor/src/hooks/border.js
index 81cc023bab..3766b56912 100644
--- a/packages/block-editor/src/hooks/border.js
+++ b/packages/block-editor/src/hooks/border.js
@@ -275,6 +275,7 @@ export function BorderPanel( props ) {
 						value={ hydratedBorder }
 						__experimentalHasMultipleOrigins={ true }
 						__experimentalIsRenderedInSidebar={ true }
+						__next40pxDefaultSize={ true }
 					/>
 				</ToolsPanelItem>
 			) }
diff --git a/packages/edit-site/src/components/global-styles/border-panel.js b/packages/edit-site/src/components/global-styles/border-panel.js
index 71fe697697..f9fcf1951f 100644
--- a/packages/edit-site/src/components/global-styles/border-panel.js
+++ b/packages/edit-site/src/components/global-styles/border-panel.js
@@ -186,6 +186,7 @@ export default function BorderPanel( { name } ) {
 						popoverOffset={ 40 }
 						__experimentalHasMultipleOrigins={ true }
 						__experimentalIsRenderedInSidebar={ true }
+						__next40pxDefaultSize={ true }
 					/>
 				</ToolsPanelItem>
 			) }
@@ -201,6 +202,7 @@ export default function BorderPanel( { name } ) {
 						onChange={ ( value ) => {
 							setBorderRadius( value || undefined );
 						} }
+						__next40pxDefaultSize={ true }
 					/>
 				</ToolsPanelItem>
 			) }

Screenshots or screencast

Global Styles
Before After
Screen Shot 2022-06-22 at 5 34 22 pm Screen Shot 2022-06-22 at 5 30 27 pm
Block Editor
Before After
Screen Shot 2022-06-22 at 6 18 19 pm Screen Shot 2022-06-22 at 4 52 15 pm

@aaronrobertshaw aaronrobertshaw added [Type] Enhancement A suggestion for improvement. [Feature] UI Components Impacts or related to the UI component system [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi labels Jun 22, 2022
@aaronrobertshaw aaronrobertshaw self-assigned this Jun 22, 2022
@github-actions
Copy link

github-actions bot commented Jun 22, 2022

Size Change: -8 B (0%)

Total Size: 1.28 MB

Filename Size Change
build/block-editor/index.min.js 169 kB +15 B (0%)
build/block-editor/style-rtl.css 15.8 kB -21 B (0%)
build/block-editor/style.css 15.8 kB -21 B (0%)
build/components/index.min.js 202 kB +15 B (0%)
build/edit-site/index.min.js 58 kB +4 B (0%)
ℹ️ View Unchanged
Filename Size
build/a11y/index.min.js 982 B
build/annotations/index.min.js 2.76 kB
build/api-fetch/index.min.js 2.26 kB
build/autop/index.min.js 2.14 kB
build/blob/index.min.js 475 B
build/block-directory/index.min.js 7.09 kB
build/block-directory/style-rtl.css 990 B
build/block-directory/style.css 991 B
build/block-editor/default-editor-styles-rtl.css 378 B
build/block-editor/default-editor-styles.css 378 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 84 B
build/block-library/blocks/avatar/style.css 84 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 482 B
build/block-library/blocks/button/editor.css 482 B
build/block-library/blocks/button/style-rtl.css 532 B
build/block-library/blocks/button/style.css 532 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 84 B
build/block-library/blocks/categories/editor.css 83 B
build/block-library/blocks/categories/style-rtl.css 100 B
build/block-library/blocks/categories/style.css 100 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 406 B
build/block-library/blocks/columns/style.css 406 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 612 B
build/block-library/blocks/cover/editor.css 613 B
build/block-library/blocks/cover/style-rtl.css 1.57 kB
build/block-library/blocks/cover/style.css 1.55 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 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 300 B
build/block-library/blocks/file/editor.css 300 B
build/block-library/blocks/file/style-rtl.css 253 B
build/block-library/blocks/file/style.css 254 B
build/block-library/blocks/file/view.min.js 346 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 948 B
build/block-library/blocks/gallery/editor.css 950 B
build/block-library/blocks/gallery/style-rtl.css 1.53 kB
build/block-library/blocks/gallery/style.css 1.53 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 394 B
build/block-library/blocks/group/editor.css 394 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 327 B
build/block-library/blocks/html/editor.css 329 B
build/block-library/blocks/image/editor-rtl.css 880 B
build/block-library/blocks/image/editor.css 880 B
build/block-library/blocks/image/style-rtl.css 627 B
build/block-library/blocks/image/style.css 630 B
build/block-library/blocks/image/theme-rtl.css 126 B
build/block-library/blocks/image/theme.css 126 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 213 B
build/block-library/blocks/latest-posts/editor.css 212 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 507 B
build/block-library/blocks/media-text/style.css 505 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 705 B
build/block-library/blocks/navigation-link/editor.css 703 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 296 B
build/block-library/blocks/navigation-submenu/editor.css 295 B
build/block-library/blocks/navigation/editor-rtl.css 2.02 kB
build/block-library/blocks/navigation/editor.css 2.03 kB
build/block-library/blocks/navigation/style-rtl.css 2.17 kB
build/block-library/blocks/navigation/style.css 2.16 kB
build/block-library/blocks/navigation/view-modal.min.js 2.78 kB
build/block-library/blocks/navigation/view.min.js 443 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 174 B
build/block-library/blocks/paragraph/editor.css 174 B
build/block-library/blocks/paragraph/style-rtl.css 279 B
build/block-library/blocks/paragraph/style.css 281 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 493 B
build/block-library/blocks/post-comments-form/style.css 493 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 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 586 B
build/block-library/blocks/post-featured-image/editor.css 584 B
build/block-library/blocks/post-featured-image/style-rtl.css 315 B
build/block-library/blocks/post-featured-image/style.css 315 B
build/block-library/blocks/post-navigation-link/style-rtl.css 153 B
build/block-library/blocks/post-navigation-link/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 282 B
build/block-library/blocks/post-template/style.css 282 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-title/style-rtl.css 100 B
build/block-library/blocks/post-title/style.css 100 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 135 B
build/block-library/blocks/pullquote/editor.css 135 B
build/block-library/blocks/pullquote/style-rtl.css 326 B
build/block-library/blocks/pullquote/style.css 325 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 282 B
build/block-library/blocks/query-pagination/style.css 278 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 439 B
build/block-library/blocks/query/editor.css 439 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 409 B
build/block-library/blocks/search/style.css 406 B
build/block-library/blocks/search/theme-rtl.css 114 B
build/block-library/blocks/search/theme.css 114 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 234 B
build/block-library/blocks/separator/style.css 234 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 464 B
build/block-library/blocks/shortcode/editor.css 464 B
build/block-library/blocks/site-logo/editor-rtl.css 490 B
build/block-library/blocks/site-logo/editor.css 490 B
build/block-library/blocks/site-logo/style-rtl.css 203 B
build/block-library/blocks/site-logo/style.css 203 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 674 B
build/block-library/blocks/social-links/editor.css 673 B
build/block-library/blocks/social-links/style-rtl.css 1.4 kB
build/block-library/blocks/social-links/style.css 1.39 kB
build/block-library/blocks/spacer/editor-rtl.css 322 B
build/block-library/blocks/spacer/editor.css 322 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 494 B
build/block-library/blocks/table/editor.css 494 B
build/block-library/blocks/table/style-rtl.css 611 B
build/block-library/blocks/table/style.css 609 B
build/block-library/blocks/table/theme-rtl.css 190 B
build/block-library/blocks/table/theme.css 190 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 235 B
build/block-library/blocks/template-part/editor.css 235 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 691 B
build/block-library/blocks/video/editor.css 694 B
build/block-library/blocks/video/style-rtl.css 174 B
build/block-library/blocks/video/style.css 174 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 162 B
build/block-library/classic.css 162 B
build/block-library/common-rtl.css 1.02 kB
build/block-library/common.css 1.02 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.2 kB
build/block-library/editor.css 11.2 kB
build/block-library/elements-rtl.css 54 B
build/block-library/elements.css 54 B
build/block-library/index.min.js 192 kB
build/block-library/reset-rtl.css 478 B
build/block-library/reset.css 478 B
build/block-library/style-rtl.css 12.3 kB
build/block-library/style.css 12.3 kB
build/block-library/theme-rtl.css 719 B
build/block-library/theme.css 722 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 49.9 kB
build/components/style-rtl.css 11.3 kB
build/components/style.css 11.3 kB
build/compose/index.min.js 12.2 kB
build/core-data/index.min.js 15.5 kB
build/customize-widgets/index.min.js 11.3 kB
build/customize-widgets/style-rtl.css 1.38 kB
build/customize-widgets/style.css 1.38 kB
build/data-controls/index.min.js 653 B
build/data/index.min.js 8.08 kB
build/date/index.min.js 32.1 kB
build/deprecated/index.min.js 507 B
build/dom-ready/index.min.js 324 B
build/dom/index.min.js 4.7 kB
build/edit-navigation/index.min.js 16.1 kB
build/edit-navigation/style-rtl.css 3.99 kB
build/edit-navigation/style.css 4 kB
build/edit-post/classic-rtl.css 546 B
build/edit-post/classic.css 547 B
build/edit-post/index.min.js 34.2 kB
build/edit-post/style-rtl.css 7.33 kB
build/edit-post/style.css 7.32 kB
build/edit-site/style-rtl.css 8.37 kB
build/edit-site/style.css 8.35 kB
build/edit-widgets/index.min.js 16.7 kB
build/edit-widgets/style-rtl.css 4.34 kB
build/edit-widgets/style.css 4.34 kB
build/editor/index.min.js 43.6 kB
build/editor/style-rtl.css 3.62 kB
build/editor/style.css 3.61 kB
build/element/index.min.js 4.68 kB
build/escape-html/index.min.js 537 B
build/experiments/index.min.js 868 B
build/format-library/index.min.js 6.95 kB
build/format-library/style-rtl.css 571 B
build/format-library/style.css 571 B
build/hooks/index.min.js 1.64 kB
build/html-entities/index.min.js 448 B
build/i18n/index.min.js 3.77 kB
build/is-shallow-equal/index.min.js 527 B
build/keyboard-shortcuts/index.min.js 1.78 kB
build/keycodes/index.min.js 1.83 kB
build/list-reusable-blocks/index.min.js 2.13 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.93 kB
build/notices/index.min.js 963 B
build/nux/index.min.js 2.06 kB
build/nux/style-rtl.css 732 B
build/nux/style.css 728 B
build/plugins/index.min.js 1.94 kB
build/preferences-persistence/index.min.js 2.22 kB
build/preferences/index.min.js 1.33 kB
build/primitives/index.min.js 944 B
build/priority-queue/index.min.js 1.58 kB
build/react-i18n/index.min.js 696 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.74 kB
build/reusable-blocks/index.min.js 2.21 kB
build/reusable-blocks/style-rtl.css 256 B
build/reusable-blocks/style.css 256 B
build/rich-text/index.min.js 10.6 kB
build/server-side-render/index.min.js 1.77 kB
build/shortcode/index.min.js 1.53 kB
build/style-engine/index.min.js 1.46 kB
build/token-list/index.min.js 644 B
build/url/index.min.js 3.61 kB
build/vendors/inert-polyfill.min.js 2.48 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 268 B
build/widgets/index.min.js 7.21 kB
build/widgets/style-rtl.css 1.18 kB
build/widgets/style.css 1.19 kB
build/wordcount/index.min.js 1.06 kB

compressed-size-action

@aaronrobertshaw aaronrobertshaw force-pushed the update/border-controls-to-40px-height branch 2 times, most recently from e74524c to e843ae8 Compare September 26, 2022 04:06
@aaronrobertshaw
Copy link
Contributor Author

This PR has been updated to also include turning on the 40px high input in our editors as per this request.

We've recently updated the styling for large control variants within the editors to increase internal padding. For example, the UnitControl using the __unstable-large size gets increased padding on its input as well as prefix and suffix.

This is a bit of a problem currently for the border controls as they use both a prefix and a suffix. When also constrained by the width of our sidebar there isn't much space to actually display entered values. This is accentuated further in the split view, configuring individual sides.

Click for demo of above issue before tweaks
Screen.Recording.2022-09-26.at.2.51.36.pm.mp4

I've taken an initial pass at trying to tweak the control styles and input widths to maximise the space available without overriding the UnitControl's padding so as to keep it in line with other controls. It's better but there's still a lot more that needs improving.

@jasmussen or @jameskoster, if you have time to cast an eye over this and provide your thoughts and suggestions, it would be greatly appreciated 🙇

Click for demo of current state in this PR
Screen.Recording.2022-09-26.at.2.55.33.pm.mp4

@jameskoster
Copy link
Contributor

Thanks for the ping @aaronrobertshaw.

I just mocked this up in Figma (aligned to the grid we've been working towards) and everything seems to fit okay:

Screenshot 2022-09-26 at 11 17 58

At a quick glance, I think we can increase the width of the inputs in the unlinked view, but ideally we should aim to fit the grid.

In case it's helpful, here's the Figma file to inspect which should include all relevant values.

@jasmussen
Copy link
Contributor

Thank you for working on this, this is excellent attention to detail 🙏

Jay summarizes well. I'll only add — and this may not be needed for this PR — that it'd be nice of the "Swatch box" could be square. This one:

Screenshot 2022-09-26 at 13 27 03

@jameskoster
Copy link
Contributor

that it'd be nice of the "Swatch box" could be square

I thought it was, good spot 😅

@aaronrobertshaw
Copy link
Contributor Author

I just mocked this up in Figma (aligned to the grid we've been working towards) and everything seems to fit okay:

Thanks for the updated mockup and figma file @jameskoster 👍

I'll massage the component into shape today.

that it'd be nice of the "Swatch box" could be square

This was something I'd tweaked locally but exacerbated the issue of overly constraining the display of the input value so I left it out for this first pass. It's an easy change if we are able to increase the overall input width.

@aaronrobertshaw
Copy link
Contributor Author

I've given the border control styles another pass. It's getting closer, but there are a couple of minor issues still for it to be pixel perfect.

The figma file suggests the panel is 284px wide, whereas the sidebar in our editors is 280px. That means using the 118px width for inputs as per the mockup causes things to overflow by a few pixels. I reduced the input width to 116px so they fit neatly.

Regardless of whether the inputs were 116px or 118px, numeric values with 3 digits or decimals get ever so slightly truncated.

3 Digits Decimal
Screen Shot 2022-09-27 at 4 21 50 pm Screen Shot 2022-09-27 at 4 22 11 pm

The Mixed placeholder text gets more truncated after these latest changes so you now only see Mix.

Screen Shot 2022-09-27 at 4 22 39 pm

I looked at removing the unit select when the border control has a mixed set of borders however this felt rather odd when it was just a color difference causing the mixed state. The control was designed so even if the colors were different you could still adjust the width value and unit as desired.

The border radius control has also been updated so it appears more in line with the main border control.

Here's a quick video of the current state of these controls.

Screen.Recording.2022-09-27.at.3.44.24.pm.mp4

Any thoughts on ways to improve the controls from here?

@jameskoster
Copy link
Contributor

For the truncation issue, I think the best solution would be to remove the padding on the unit button. Doing so ensures 24x24px dimensions which are acceptable, and creates just enough space for rem, the longest unit:

Screenshot 2022-09-27 at 10 35 45

Ideally that wouldn't be an override for just this control. Do we need a new button variant? It doesn't look like we have a simple no-padding, no-border option 🤔

This doesn't quite create enough room for the 'Mixed' value though. Must it say 'Mixed', or is 'Mix' adequate? That fits:

Screenshot 2022-09-27 at 10 42 44

The only other option I can think of would be to hide the unit input when the values are mixed... it doesn't seem to work properly at the moment anyway 🙈

@aaronrobertshaw aaronrobertshaw force-pushed the update/border-controls-to-40px-height branch from d90c6b3 to a10eb32 Compare September 28, 2022 09:19
@aaronrobertshaw
Copy link
Contributor Author

Appreciate the continued feedback @jameskoster 🙇

For the truncation issue, I think the best solution would be to remove the padding on the unit button. Doing so ensures 24x24px dimensions which are acceptable, and creates just enough space for rem, the longest unit:

I haven't pushed the removal of padding from the unit select button yet as I got caught up exploring the potential removal of the unit select button when we have mixed values. That said, it does provide just enough breathing room for those longer values. The plan is to also strip the unit select's padding from the radius control as well so at least the two controls that are next to each other in that panel match up.

This doesn't quite create enough room for the 'Mixed' value though. Must it say 'Mixed', or is 'Mix' adequate?

I'm not sure if 'Mix' is adequate, it seems like a poorer option to me than 'Mixed', however, I think we are short of alternatives at this point. At least in terms of placeholders. On top of that, languages other than English will likely struggle to find something meaningful that is 3 characters or less.

when the values are mixed... it doesn't seem to work properly at the moment anyway 🙈

The BorderBoxControl and BorderRadiusControl do behave slightly differently when mixed values are present. I have something in the works here that should bring them closer regarding functionality while still allowing some of the other border properties to be updated as originally intended.

That would be better as a separate PR focused on those changes independent of the visual tweaks here. I'll publish a PR for it tomorrow.

@jameskoster
Copy link
Contributor

I think we are short of alternatives at this point

Could another option be a wildcard label, IE "*"? I'm not sure how intuitive that would be though. Perhaps with a tooltip it's be ok?

Screenshot 2022-09-28 at 10 59 40

Another thought... does the linked control really need to support mixed values? What if toggling away from unlinked borders re-linked them automatically?

@aaronrobertshaw
Copy link
Contributor Author

Could another option be a wildcard label, IE "*"? I'm not sure how intuitive that would be though. Perhaps with a tooltip it's be ok?

That's an interesting idea. It might not be 100% intuitive but I don't know that it is any worse than "Mix" or whatever non-English placeholders get truncated to.

The addition of the tooltip might be a little bit trickier. I think we'd need to be able to apply the tooltip to the UnitControl's inner input as we already have a tooltip on the color/style dropdown. Without being able to target the inner input we'd end up with multiple tooltips when the color and style dropdown was hovered over.

There's a draft PR up that explores adding a tooltip for an InputControl's inner input. That was put on hold until we could sort out a broader approach via #42630.

Another thought... does the linked control really need to support mixed values? What if toggling away from unlinked borders re-linked them automatically?

I think it might cause some friction if this control behaves differently than those around it. The spacing controls for padding, margin etc, box controls, and the border radius control, all allow that mixed state without "re-linking" the values.

I'm also aware of users relying on that link button to simply collapse the control in the sidebar so it doesn't take up so much space. Now the inspector controls sidebar primarily uses the ToolsPanel; there isn't yet a means of collapsing the panel or removing a control from display without resetting it.

There's been discussion around adding a way to collapse ToolsPanels but they tend to fizzle out due to crowding the panel with buttons or obscure behaviour.


Instead of a tooltip, could we leverage some help text?

This might provide a way to;

  • communicate the mixed state,
  • be similar to the 'Mixed' text added to spacing control labels,
  • provide extra space for other languages,
  • avoid issues with multiple tooltips

From an a11y point of view, might it also provide an improvement over the simple placeholder?

Screen Shot 2022-09-29 at 6 18 43 pm Screen Shot 2022-09-29 at 6 20 56 pm

@jasmussen
Copy link
Contributor

Thanks for all the work here, this is a strong improvement!

About the "Mixed" issue, I would avoid showing values in helper text. The asterisk could work. But I would think the strongest solution is to hide the "px" unit and show the regular "Mixed" text in the input (the units can be mixed too, afterall). Even if we have to elide the text to "Mix.", or simply allow it to be cropped by the input field, that still feels the most clear and simple.

That's not to say we can't come back to this with stronger solutions, at a later point. It may also be possible to earn some space back by exploring a design that omits the separator between border indicator and value:

Screenshot 2022-09-29 at 13 49 39

But that's for a different time!

@ciampo
Copy link
Contributor

ciampo commented Sep 29, 2022

This is a good one for @mirka to check once she's back from AFK

@ciampo ciampo requested a review from mirka September 29, 2022 11:57
@aaronrobertshaw
Copy link
Contributor Author

Thank you to everyone for all the feedback, thoughts, and ideas 🙇

I've switched the border controls back to using the 'Mixed' placeholder (962a853). I'll create a separate PR removing the unit select when there are mixed values.

@aaronrobertshaw aaronrobertshaw force-pushed the update/border-controls-to-40px-height branch from 072f6af to 832c018 Compare October 26, 2022 09:58
@ciampo
Copy link
Contributor

ciampo commented Oct 26, 2022

@aaronrobertshaw happy to merge this PR today in case it gets late for you

@ciampo ciampo merged commit 1b8fd2b into trunk Oct 26, 2022
@ciampo ciampo deleted the update/border-controls-to-40px-height branch October 26, 2022 16:12
@github-actions github-actions bot added this to the Gutenberg 14.5 milestone Oct 26, 2022
@aaronrobertshaw
Copy link
Contributor Author

happy to merge this PR today in case it gets late for you

Thanks for handling the merge. The tests were still running when I had to log off for the day.

Great to see it merged when logging in 🎉

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 [Feature] UI Components Impacts or related to the UI component system Needs User Documentation Needs new user documentation [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants