-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Global Styles: Fix display of color palettes for border panel #38798
Global Styles: Fix display of color palettes for border panel #38798
Conversation
Size Change: +4 B (0%) Total Size: 1.16 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I followed your testing steps and it fixes the bug! 👍
The code looks really good to me, too.
Just a question on whether to refactor useMultiOriginColors
a little bit.
Also, what's the state of E2E testing for global styles? Is it worth adding a regression test for this bug?
@@ -68,6 +65,52 @@ function useHasBorderWidthControl( name ) { | |||
); | |||
} | |||
|
|||
function useMultiOriginColors( name ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's some overlap between this hook and useMultipleOriginColorsAndGradients
in packages/block-editor/src/components/colors-gradients/use-multiple-origin-colors-and-gradients.js
. Do you think we should DRY that up? Or do you think it's too soon?
I can envision that a future developer might fix a bug or update a string in useMultipleOriginColorsAndGradients
but not useMultiOriginColors
because the Border panel that appears in the block settings sidebar is more obvious than the one that appears in global styles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's some overlap between this hook and useMultipleOriginColorsAndGradients
Thanks for the nudge to DRY this up.
Upon revisiting this I've found the useColorsPerOrigin
hook that was introduced to the site editor not too long before I opened this PR. I missed it as I was expecting a similar name to what was already in the block editor.
It took the same approach as the hook I previously had in this PR so I've updated these changes to leverage that instead. This means that all the color supports (background, link & text) along with border color use the same hook now.
bacfeab
to
c8da70d
Compare
Thanks for the review @noisysocks 🙇
I'm not clear on what sort of coverage we are aiming for with global styles. Now, this PR leverages the existing There are also a few open PRs ( #37769, #37770, #38876 ) that should be close to landing that will re-work the border controls. As such, I'd be tempted to delay adding any testing around the border UI in Global Styles until they land. Ultimately, I'm not sure if it is worth adding a regression test for this but I don't feel strongly about it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good with move to shared hook. Works as advertised for me:
Before:
before.mp4
After:
after.mp4
I agree that it is probably worth waiting until things stabilise a bit more before adding an e2e.
I think a rebase will fix the test failures. |
Also switches to use the new ColorGradientSettingsDropdown like the block editor.
c8da70d
to
ceb6646
Compare
Description
The Global Styles border panel appears to only display the last source color palette. This PR updates the Global Styles border panel to display multi-origin color palettes as well as use the same dropdown style as the block editor for border color.
Testing Instructions
Screenshots
Types of changes
Bug fix.
Checklist:
*.native.js
files for terms that need renaming or removal).