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

Update: Custom gradient picker design. #34712

Merged
merged 3 commits into from
Sep 24, 2021

Conversation

jorgefilipecosta
Copy link
Member

@jorgefilipecosta jorgefilipecosta commented Sep 9, 2021

This PR updates the design of the custom gradient picker to the new version.
Part of: #34574

Before After
color-picker-after color-picker-after

@jorgefilipecosta jorgefilipecosta added [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi [Feature] Component System WordPress component system labels Sep 9, 2021
@github-actions
Copy link

github-actions bot commented Sep 9, 2021

Size Change: +219 B (0%)

Total Size: 1.06 MB

Filename Size Change
build/components/index.min.js 210 kB +20 B (0%)
build/components/style-rtl.css 16 kB +99 B (+1%)
build/components/style.css 16 kB +100 B (+1%)
ℹ️ View Unchanged
Filename Size
build/a11y/index.min.js 931 B
build/admin-manifest/index.min.js 1.09 kB
build/annotations/index.min.js 2.7 kB
build/api-fetch/index.min.js 2.19 kB
build/autop/index.min.js 2.08 kB
build/blob/index.min.js 459 B
build/block-directory/index.min.js 6.19 kB
build/block-directory/style-rtl.css 1.01 kB
build/block-directory/style.css 1.01 kB
build/block-editor/default-editor-styles-rtl.css 378 B
build/block-editor/default-editor-styles.css 378 B
build/block-editor/index.min.js 134 kB
build/block-editor/style-rtl.css 13.9 kB
build/block-editor/style.css 13.8 kB
build/block-library/blocks/archives/editor-rtl.css 61 B
build/block-library/blocks/archives/editor.css 60 B
build/block-library/blocks/archives/style-rtl.css 65 B
build/block-library/blocks/archives/style.css 65 B
build/block-library/blocks/audio/editor-rtl.css 58 B
build/block-library/blocks/audio/editor.css 58 B
build/block-library/blocks/audio/style-rtl.css 111 B
build/block-library/blocks/audio/style.css 111 B
build/block-library/blocks/audio/theme-rtl.css 125 B
build/block-library/blocks/audio/theme.css 125 B
build/block-library/blocks/block/editor-rtl.css 161 B
build/block-library/blocks/block/editor.css 161 B
build/block-library/blocks/button/editor-rtl.css 474 B
build/block-library/blocks/button/editor.css 474 B
build/block-library/blocks/button/style-rtl.css 600 B
build/block-library/blocks/button/style.css 600 B
build/block-library/blocks/buttons/editor-rtl.css 315 B
build/block-library/blocks/buttons/editor.css 315 B
build/block-library/blocks/buttons/style-rtl.css 370 B
build/block-library/blocks/buttons/style.css 370 B
build/block-library/blocks/calendar/style-rtl.css 207 B
build/block-library/blocks/calendar/style.css 207 B
build/block-library/blocks/categories/editor-rtl.css 84 B
build/block-library/blocks/categories/editor.css 83 B
build/block-library/blocks/categories/style-rtl.css 79 B
build/block-library/blocks/categories/style.css 79 B
build/block-library/blocks/code/style-rtl.css 90 B
build/block-library/blocks/code/style.css 90 B
build/block-library/blocks/code/theme-rtl.css 131 B
build/block-library/blocks/code/theme.css 131 B
build/block-library/blocks/columns/editor-rtl.css 206 B
build/block-library/blocks/columns/editor.css 205 B
build/block-library/blocks/columns/style-rtl.css 497 B
build/block-library/blocks/columns/style.css 496 B
build/block-library/blocks/cover/editor-rtl.css 666 B
build/block-library/blocks/cover/editor.css 670 B
build/block-library/blocks/cover/style-rtl.css 1.23 kB
build/block-library/blocks/cover/style.css 1.23 kB
build/block-library/blocks/embed/editor-rtl.css 488 B
build/block-library/blocks/embed/editor.css 488 B
build/block-library/blocks/embed/style-rtl.css 417 B
build/block-library/blocks/embed/style.css 417 B
build/block-library/blocks/embed/theme-rtl.css 124 B
build/block-library/blocks/embed/theme.css 124 B
build/block-library/blocks/file/editor-rtl.css 300 B
build/block-library/blocks/file/editor.css 300 B
build/block-library/blocks/file/style-rtl.css 255 B
build/block-library/blocks/file/style.css 255 B
build/block-library/blocks/file/view.min.js 322 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 983 B
build/block-library/blocks/gallery/editor.css 988 B
build/block-library/blocks/gallery/style-rtl.css 1.6 kB
build/block-library/blocks/gallery/style.css 1.59 kB
build/block-library/blocks/gallery/theme-rtl.css 122 B
build/block-library/blocks/gallery/theme.css 122 B
build/block-library/blocks/group/editor-rtl.css 159 B
build/block-library/blocks/group/editor.css 159 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 114 B
build/block-library/blocks/heading/style.css 114 B
build/block-library/blocks/home-link/style-rtl.css 247 B
build/block-library/blocks/home-link/style.css 247 B
build/block-library/blocks/html/editor-rtl.css 332 B
build/block-library/blocks/html/editor.css 333 B
build/block-library/blocks/image/editor-rtl.css 728 B
build/block-library/blocks/image/editor.css 728 B
build/block-library/blocks/image/style-rtl.css 482 B
build/block-library/blocks/image/style.css 487 B
build/block-library/blocks/image/theme-rtl.css 124 B
build/block-library/blocks/image/theme.css 124 B
build/block-library/blocks/latest-comments/style-rtl.css 284 B
build/block-library/blocks/latest-comments/style.css 284 B
build/block-library/blocks/latest-posts/editor-rtl.css 137 B
build/block-library/blocks/latest-posts/editor.css 137 B
build/block-library/blocks/latest-posts/style-rtl.css 528 B
build/block-library/blocks/latest-posts/style.css 527 B
build/block-library/blocks/list/style-rtl.css 94 B
build/block-library/blocks/list/style.css 94 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 488 B
build/block-library/blocks/media-text/style.css 485 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 568 B
build/block-library/blocks/navigation-link/editor.css 570 B
build/block-library/blocks/navigation-link/style-rtl.css 94 B
build/block-library/blocks/navigation-link/style.css 94 B
build/block-library/blocks/navigation-submenu/editor-rtl.css 300 B
build/block-library/blocks/navigation-submenu/editor.css 299 B
build/block-library/blocks/navigation-submenu/style-rtl.css 195 B
build/block-library/blocks/navigation-submenu/style.css 195 B
build/block-library/blocks/navigation-submenu/view.min.js 343 B
build/block-library/blocks/navigation/editor-rtl.css 1.72 kB
build/block-library/blocks/navigation/editor.css 1.72 kB
build/block-library/blocks/navigation/style-rtl.css 1.48 kB
build/block-library/blocks/navigation/style.css 1.47 kB
build/block-library/blocks/navigation/view.min.js 2.74 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 198 B
build/block-library/blocks/page-list/style.css 198 B
build/block-library/blocks/paragraph/editor-rtl.css 157 B
build/block-library/blocks/paragraph/editor.css 157 B
build/block-library/blocks/paragraph/style-rtl.css 273 B
build/block-library/blocks/paragraph/style.css 273 B
build/block-library/blocks/post-author/editor-rtl.css 210 B
build/block-library/blocks/post-author/editor.css 210 B
build/block-library/blocks/post-author/style-rtl.css 182 B
build/block-library/blocks/post-author/style.css 181 B
build/block-library/blocks/post-comments-form/style-rtl.css 140 B
build/block-library/blocks/post-comments-form/style.css 140 B
build/block-library/blocks/post-comments/style-rtl.css 360 B
build/block-library/blocks/post-comments/style.css 359 B
build/block-library/blocks/post-content/editor-rtl.css 138 B
build/block-library/blocks/post-content/editor.css 138 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 398 B
build/block-library/blocks/post-featured-image/editor.css 398 B
build/block-library/blocks/post-featured-image/style-rtl.css 143 B
build/block-library/blocks/post-featured-image/style.css 143 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 378 B
build/block-library/blocks/post-template/style.css 379 B
build/block-library/blocks/post-terms/style-rtl.css 73 B
build/block-library/blocks/post-terms/style.css 73 B
build/block-library/blocks/post-title/style-rtl.css 60 B
build/block-library/blocks/post-title/style.css 60 B
build/block-library/blocks/preformatted/style-rtl.css 103 B
build/block-library/blocks/preformatted/style.css 103 B
build/block-library/blocks/pullquote/editor-rtl.css 198 B
build/block-library/blocks/pullquote/editor.css 198 B
build/block-library/blocks/pullquote/style-rtl.css 378 B
build/block-library/blocks/pullquote/style.css 378 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 262 B
build/block-library/blocks/query-pagination/editor.css 255 B
build/block-library/blocks/query-pagination/style-rtl.css 234 B
build/block-library/blocks/query-pagination/style.css 231 B
build/block-library/blocks/query-title/editor-rtl.css 85 B
build/block-library/blocks/query-title/editor.css 85 B
build/block-library/blocks/query/editor-rtl.css 131 B
build/block-library/blocks/query/editor.css 132 B
build/block-library/blocks/quote/style-rtl.css 187 B
build/block-library/blocks/quote/style.css 187 B
build/block-library/blocks/quote/theme-rtl.css 220 B
build/block-library/blocks/quote/theme.css 222 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 374 B
build/block-library/blocks/search/style.css 375 B
build/block-library/blocks/search/theme-rtl.css 64 B
build/block-library/blocks/search/theme.css 64 B
build/block-library/blocks/separator/editor-rtl.css 99 B
build/block-library/blocks/separator/editor.css 99 B
build/block-library/blocks/separator/style-rtl.css 250 B
build/block-library/blocks/separator/style.css 250 B
build/block-library/blocks/separator/theme-rtl.css 172 B
build/block-library/blocks/separator/theme.css 172 B
build/block-library/blocks/shortcode/editor-rtl.css 474 B
build/block-library/blocks/shortcode/editor.css 474 B
build/block-library/blocks/site-logo/editor-rtl.css 462 B
build/block-library/blocks/site-logo/editor.css 464 B
build/block-library/blocks/site-logo/style-rtl.css 153 B
build/block-library/blocks/site-logo/style.css 153 B
build/block-library/blocks/site-tagline/editor-rtl.css 86 B
build/block-library/blocks/site-tagline/editor.css 86 B
build/block-library/blocks/site-title/editor-rtl.css 84 B
build/block-library/blocks/site-title/editor.css 84 B
build/block-library/blocks/social-link/editor-rtl.css 165 B
build/block-library/blocks/social-link/editor.css 165 B
build/block-library/blocks/social-links/editor-rtl.css 812 B
build/block-library/blocks/social-links/editor.css 811 B
build/block-library/blocks/social-links/style-rtl.css 1.3 kB
build/block-library/blocks/social-links/style.css 1.3 kB
build/block-library/blocks/spacer/editor-rtl.css 307 B
build/block-library/blocks/spacer/editor.css 307 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 471 B
build/block-library/blocks/table/editor.css 472 B
build/block-library/blocks/table/style-rtl.css 481 B
build/block-library/blocks/table/style.css 481 B
build/block-library/blocks/table/theme-rtl.css 188 B
build/block-library/blocks/table/theme.css 188 B
build/block-library/blocks/tag-cloud/style-rtl.css 146 B
build/block-library/blocks/tag-cloud/style.css 146 B
build/block-library/blocks/template-part/editor-rtl.css 636 B
build/block-library/blocks/template-part/editor.css 635 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/editor-rtl.css 90 B
build/block-library/blocks/term-description/editor.css 90 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 571 B
build/block-library/blocks/video/editor.css 572 B
build/block-library/blocks/video/style-rtl.css 173 B
build/block-library/blocks/video/style.css 173 B
build/block-library/blocks/video/theme-rtl.css 124 B
build/block-library/blocks/video/theme.css 124 B
build/block-library/common-rtl.css 853 B
build/block-library/common.css 849 B
build/block-library/editor-rtl.css 9.76 kB
build/block-library/editor.css 9.75 kB
build/block-library/index.min.js 148 kB
build/block-library/reset-rtl.css 527 B
build/block-library/reset.css 527 B
build/block-library/style-rtl.css 10.3 kB
build/block-library/style.css 10.3 kB
build/block-library/theme-rtl.css 665 B
build/block-library/theme.css 669 B
build/block-serialization-default-parser/index.min.js 1.09 kB
build/block-serialization-spec-parser/index.min.js 2.79 kB
build/blocks/index.min.js 47 kB
build/compose/index.min.js 10.3 kB
build/core-data/index.min.js 12.3 kB
build/customize-widgets/index.min.js 11.1 kB
build/customize-widgets/style-rtl.css 1.5 kB
build/customize-widgets/style.css 1.49 kB
build/data-controls/index.min.js 614 B
build/data/index.min.js 7.1 kB
build/date/index.min.js 31.5 kB
build/deprecated/index.min.js 428 B
build/dom-ready/index.min.js 304 B
build/dom/index.min.js 4.45 kB
build/edit-navigation/index.min.js 15.5 kB
build/edit-navigation/style-rtl.css 3.69 kB
build/edit-navigation/style.css 3.69 kB
build/edit-post/classic-rtl.css 492 B
build/edit-post/classic.css 494 B
build/edit-post/index.min.js 29 kB
build/edit-post/style-rtl.css 7.18 kB
build/edit-post/style.css 7.17 kB
build/edit-site/index.min.js 27.7 kB
build/edit-site/style-rtl.css 5.22 kB
build/edit-site/style.css 5.21 kB
build/edit-widgets/index.min.js 16.1 kB
build/edit-widgets/style-rtl.css 4.09 kB
build/edit-widgets/style.css 4.09 kB
build/editor/index.min.js 37.4 kB
build/editor/style-rtl.css 3.76 kB
build/editor/style.css 3.75 kB
build/element/index.min.js 3.17 kB
build/escape-html/index.min.js 517 B
build/format-library/index.min.js 5.34 kB
build/format-library/style-rtl.css 668 B
build/format-library/style.css 670 B
build/hooks/index.min.js 1.55 kB
build/html-entities/index.min.js 424 B
build/i18n/index.min.js 3.6 kB
build/is-shallow-equal/index.min.js 501 B
build/keyboard-shortcuts/index.min.js 1.72 kB
build/keycodes/index.min.js 1.3 kB
build/list-reusable-blocks/index.min.js 1.85 kB
build/list-reusable-blocks/style-rtl.css 838 B
build/list-reusable-blocks/style.css 838 B
build/media-utils/index.min.js 2.88 kB
build/notices/index.min.js 845 B
build/nux/index.min.js 2.03 kB
build/nux/style-rtl.css 747 B
build/nux/style.css 743 B
build/plugins/index.min.js 1.83 kB
build/primitives/index.min.js 921 B
build/priority-queue/index.min.js 582 B
build/react-i18n/index.min.js 671 B
build/redux-routine/index.min.js 2.63 kB
build/reusable-blocks/index.min.js 2.28 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.5 kB
build/shortcode/index.min.js 1.48 kB
build/token-list/index.min.js 562 B
build/url/index.min.js 1.74 kB
build/viewport/index.min.js 1.02 kB
build/warning/index.min.js 248 B
build/widgets/index.min.js 7.11 kB
build/widgets/style-rtl.css 1.16 kB
build/widgets/style.css 1.16 kB
build/wordcount/index.min.js 1.04 kB

compressed-size-action

@jorgefilipecosta jorgefilipecosta force-pushed the update/gradient-picker-design branch 2 times, most recently from 72de3db to 5e82c6a Compare September 10, 2021 18:02
Copy link
Contributor

@jasmussen jasmussen left a comment

Choose a reason for hiding this comment

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

Very lovely work. Good progress in the metrics, dimensions and such, and remember to also test duotone:

Screenshot 2021-09-14 at 11 21 00

group

A few small things. The gradient box should have border-radius: $radius-block-ui;.

The gradient preview itself should have padding left and right, that pushes the left and right-most handles inward. I'm aware that skews the preview a bit, but that's intentional to have that extra clearance for the handle. Hre's a zoom_

Frame 520

In the above, the gradient from yellow to blue starts and ends with clearance. Meaning the part of the gradient as marked by the red squares below, are entirely flat solid colors. Technically it might be sensible to just create extra divs before and after the gradient range, then duplicate the colors as solid backgrounds on those. Make sense?

This transparent swatch, what does it do, do you know?

Screenshot 2021-09-14 at 11 27 45

Higher level, there are a few things that need to fall in place to match this:

Color

There's the collapsible color swatch that sits in an itemgroup, slides the panel right in global styles but opens as a flyout in the post editor, and then the new color picker as a layer under that opening from the gradient handles. That flow is superficially (illustrated here). As just one ingredient on the path, this is a nice one. But while we're here, should we also update some of the context surrounding the gradient picker, such as the the new segmented control for swapping between solid and gradient? Or is that for each consuming panel to address?

@@ -33,17 +34,17 @@ export const CircleIndicatorWrapper = styled.div`
`;

export const CircleIndicator = styled.div`
background: ${ COLORS.ui.border };
background: #3858e9;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this reference a variable instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately no, we don't have a variable for this color.

@@ -102,3 +97,18 @@ $components-custom-gradient-picker__padding: 6px; // 36px container, 24px handle
}
}
}

// All these styles should be made generic and changed on the inputs for all components.
Copy link
Contributor

Choose a reason for hiding this comment

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

I appreciate the "todo". It's something we might want to look into soon.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed. We should look into all control/input components and standardize their dimensions and spacing throughout the library of @wordpress/components

padding-bottom: $grid-unit-10 !important;
}
label {
text-transform: uppercase;
Copy link
Contributor

Choose a reason for hiding this comment

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

The metrics as I've extracted them from the Figma also make this inspector "Section Heading" 11px font-size with a font-weight of 500.

Copy link
Contributor

@ciampo ciampo left a comment

Choose a reason for hiding this comment

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

Hey @jorgefilipecosta , thank you for working on this!

Here are my initial thoughts:

  • I'd be curious to know why we're not using BaseControl anymore. In case it's not satisfying a certain need, we can look into improving the component directly!
  • Similar question for NumberControl — why did you decide to use InputControl instead?
  • Similarly to what @jasmussen said, I can see a few hardcoded values (especially colors, box-shadows) — it'd be great if we could use values from the shared utils/ folder as much as possible. If there arent't any values in there that could be reused, we should consider adding some of these new values directly to the shared configuration.

Thank you! I'm also asking some of these questions because I'm always interested in knowing if any of the components being used are not offering a certain feature or if they can be improved in general!

@@ -37,20 +34,18 @@ $components-custom-gradient-picker__padding: 6px; // 36px container, 24px handle
}

.components-custom-gradient-picker__control-point-button {
border: 2px solid transparent;
box-shadow: inset 0 0 0 var(--wp-admin-border-width-focus) $white;
border: 1.5px solid $white;
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if we should use sub-pixel widths — it can create rendering glitches

Copy link
Contributor

Choose a reason for hiding this comment

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

We actually use 1.5px for the focus style across the board, but good catch — that is rendered using box-shadow so as to actually function, whereas I believe borders are rounded to nearest whole.

For additional context, we usually pair the box shadow with a transparent border or outline, because in Windows High Contrast mode (which is looking like it might become a web standard), box shadows are removed entirely, but transparent colors are made opaque. So in those modes, the transparent border would work as the focus style.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi @jasmussen, here we have an issue because we have a 1.5px border and we also need a box-shadow (according to figma). So I'm not sure what we should do it seems hard to have a 1.5 border and also a box-shadow (at least without some complex hack).

Copy link
Contributor

@jasmussen jasmussen Sep 20, 2021

Choose a reason for hiding this comment

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

I took the liberty of pushing a fix in 2997a2f, which I don't think is too hacky. It just stacks multiple box shadows by comma separation:
Screenshot 2021-09-20 at 10 16 13

Copy link
Contributor

@ciampo ciampo Sep 21, 2021

Choose a reason for hiding this comment

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

I wonder if we should be using the CONFIG.borderWidthFocus variable here for the border width — and if we should change its value to be 2px instead of 1.5px (see also related #34598 (comment))

Copy link
Contributor

Choose a reason for hiding this comment

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

We should definitely use variables whenever we can. It's worth noting that we use 1.5px for focus styles across the entire editor, so it's a rather big change. What rendering glitches have you seen?

Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed this glitch in the Color Picker PR, and changing the value to 2px seemed to fix it for me — although I agree with you about this being quite an impactful change that would need a deeper investigation first.

Copy link
Contributor

Choose a reason for hiding this comment

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

But that uses border: https://github.com/WordPress/gutenberg/pull/34598/files#diff-172e1f5e636f1d05b7c28a61e4885cd8fddc9dc390952a5547d271dfb2c7663bR94 which is always rounded to nearest whole pixel. The solution I added in 2997a2f uses box-shadow, which renders on subpixels as well.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, thank you for the explanation! Should we look into applying the box-shadow technique to borders across components (including the ColorPicker PR), then?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, the benefit of box shadows is that you can stack as many of them as you need, to accomplish very complex designs, such as the 1.5px inner stroke with a subtle outer drop shadow.

The one thing we need to keep in mind, though, is to always pair it with a transparent border or outline, as box-shadows are removed entirely in Windows High Contrast mode, whereas transparent colors are made opaque. By combining both, the shadow is shown in normal modes, and the transparent outline or border is shown in high contrast modes. There's a little more nuance in this video.

@jorgefilipecosta jorgefilipecosta force-pushed the update/gradient-picker-design branch 4 times, most recently from be0b70a to a181c15 Compare September 23, 2021 17:49
@jorgefilipecosta
Copy link
Member Author

Hi @ciampo thank you for your review 👍

  • I'd be curious to know why we're not using BaseControl anymore. In case it's not satisfying a certain need, we can look into improving the component directly!

I don't think using base control here makes semantic sense. BaseControl is wrapping an input field (NumberControl or InputControl) the input fields already provide the accessibility needed. What advantage do we get with wrapping the field with a BaseControl?

  • Similar question for NumberControl — why did you decide to use InputControl instead?

Because the number control has arrows to go up and down on the value and the design does not contain the arrows but contains an angle symbol:
image

  • Similarly to what @jasmussen said, I can see a few hardcoded values (especially colors, box-shadows) — it'd be great if we could use values from the shared utils/ folder as much as possible. If there arent't any values in there that could be reused, we should consider adding some of these new values directly to the shared configuration.

I did some updates and tried to use more variables. I'm still adding a new color that's being used on the angle picker inner-circle #3858e9. It seems we don't have any variable for this color, and it is not clear if the color will be used elsewhere. I guess we can consider using a slightly different color from the one in Figma? cc: @jasmussen.

@jorgefilipecosta
Copy link
Member Author

Hi @jasmussen,
Thank you for the review and tweaks @jasmussen.
I submitted some updates including one to make the gradient cycles not touch the border.

I agree we still need considerable work to achieve the final UI. This PR tries to just focus on the custom gradient picker part without touching the surroundings that will be worked on in other PR.
Focusing just on the custom picker part it seems the missing part is the flyout color picker and using the new color picker but that part will happen when we replace the pickers. Regarding the flyout, I guess we will have a component for the flyouts right @ciampo? In that case, I guess we should wait until the component is available.

This transparent swatch, what does it do, do you know?

I never saw the swatch before, I think you have some invalid preset gradient and given that it does not render well that swatch appears.

@jorgefilipecosta
Copy link
Member Author

@jasmussen, @ciampo thank you for the reviews. Do you think we are ready to merge or is there something we should fix before?

@jasmussen
Copy link
Contributor

I never saw the swatch before, I think you have some invalid preset gradient and given that it does not render well that swatch appears.

I have this:

			"gradients": [
				{
					"slug": "red-to-purple",
					"gradient": "linear-gradient(160deg, var(--wp--preset--color--red), var(--wp--preset--color--purple))",
					"name": "Red to Purple"
				}
			]

@jasmussen
Copy link
Contributor

Took this one for a spin. Massive improvements all around. Here's a direct comparison between the figma metrics and this branch:
Screenshot 2021-09-24 at 09 35 19

The discrepancy in the input color is something to look at elsewhere and globally for the project, and the subheading looks right (font weight appears to be mostly a rendering differential). So this is nice.

The left and right padding/"clearance" is a bit bigger in the Figma file — can you tweak that easily? From what I can tell, you have about 8px, and the Figma has 16px. A rule of thumb here is that the leftmost handle sits as far from the left side as it sits from the top side of the cell.

This "Remove control point" link that appears inside the color picker, I'm assuming that's a separate issue to look at in the Color Picker component, correct?

Screenshot 2021-09-24 at 09 34 50

One last thing: it's fancy that the gradient inside the cell can rotate in addition to it rotating in the canvas. However it means the handles are no longer accurate to the gradient below them:
hey

Can we move the direction from the gradient swatch and have it always be left to right?

Other than that, looks good to go.

@jorgefilipecosta
Copy link
Member Author

Hi @jasmussen,
Now the left and right padding/"clearance" is 16px:
image

I fixed the bar and now the bar matches the control points independently of the angle.

Regarding the remove control point. I think it is something we can address during the color picker replacement. But the Figma file does not provide a mockup of how control points should be removed so as an initial version when replacing color components I guess we can keep the "Remove Control Point" link unless there is another design proposal meanwhile and In that case, we can implement it in a follow-up PR. To be worked on after the color picker is replaced.

@jasmussen jasmussen self-requested a review September 24, 2021 11:33
Copy link
Contributor

@jasmussen jasmussen 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 working well, the preview/swatch is looking good, and things are functioning nicely:
gradient picker

This is a good step forward.

I think in future iterations we can unify the handles to be even more like those from the color picker, and actually show the solid color inside the white ring (as opposed to being transparent as they are now). We can also bump the shadow opacity a bit, and enhance focus styles.

The segmented color/gradient control, and the handling of incorrect gradients (I know, bug in my theme.json it seems) feel worth looking at as well.

As already tracked, there are some efforts around unifying the component system as well with regards to input fields, subheadings and such. But this is a good step forward to a component that needs it a fair bit.

So this feels like a good step forward. Thank you!

Copy link
Contributor

@ciampo ciampo left a comment

Choose a reason for hiding this comment

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

I don't think using base control here makes semantic sense. BaseControl is wrapping an input field (NumberControl or InputControl) the input fields already provide the accessibility needed. What advantage do we get with wrapping the field with a BaseControl?

Got it. I'll look a bit more into it and reply if I find anything interesting.

Because the number control has arrows to go up and down on the value and the design does not contain the arrows but contains an angle symbol:

It looks like NumberControl has a hideHTMLArrows property, did you try setting it to false ?

If we need to go with InputControl, hould we set type="number" then on the InputControl ?

Focusing just on the custom picker part it seems the missing part is the flyout color picker and using the new color picker but that part will happen when we replace the pickers.

Yep that's the plan

Regarding the flyout, I guess we will have a component for the flyouts right @ciampo? In that case, I guess we should wait until the component is available.

We already have an experimental Flyout component, but I believe we want to first agree on a good path forward to reconcile it with the legacy Dropdown and Popover components (see #33391 for more context, and feel free to leave a comment there to move the conversation forward).

Do you think we are ready to merge or is there something we should fix before?

Apart from @jasmussen 's latest feedback, there are still a couple of items pending, like this one about a TODO comment

I think in future iterations we can unify the handles to be even more like those from the color picker, and actually show the solid color inside the white ring (as opposed to being transparent as they are now). We can also bump the shadow opacity a bit, and enhance focus styles.

The segmented color/gradient control, and the handling of incorrect gradients (I know, bug in my theme.json it seems) feel worth looking at as well.

As already tracked, there are some efforts around unifying the component system as well with regards to input fields, subheadings and such. But this is a good step forward to a component that needs it a fair bit.

I'm currently working on a tracking issue (#35093) for color-related components in the context of the general UI update that we're going through for the new global styles sidebar.

It'd be great if you could add all existing color gradient issues and the follow-up tasks to this PR!

@jorgefilipecosta jorgefilipecosta force-pushed the update/gradient-picker-design branch from 2311d40 to ee7c0cb Compare September 24, 2021 13:15
@jorgefilipecosta
Copy link
Member Author

Hi @ciampo thank you for the insights I was not aware we had hideHTMLArrows property. I used the NumberControl component with that property. I'm merging this PR and working on an inventory of follow-ups and will leave comment here and on #35093. The follow-ups are mainly generic input field changes, or enhancements/fixes that were already present in trunk without this PR.

@jorgefilipecosta jorgefilipecosta merged commit b346d7d into trunk Sep 24, 2021
@jorgefilipecosta jorgefilipecosta deleted the update/gradient-picker-design branch September 24, 2021 13:35
@github-actions github-actions bot added this to the Gutenberg 11.7 milestone Sep 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Component System WordPress component system [Feature] Design Tools Tools that impact the appearance of blocks both to expand the number of tools and improve the experi
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants