-
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
Block Support: Update border support UI #31585
Conversation
58adbc4
to
5f56717
Compare
Size Change: +13.7 kB (+1%) Total Size: 1.06 MB
ℹ️ View Unchanged
|
cbbc3d1
to
975097b
Compare
The |
Sorry for missing this one. Based on the GIF, this is a great improvement. Thanks for working on this. The ability to have per-corner custom radii is a very compelling feature. |
Not a problem at all. I deliberately left this as only a WIP draft as I wasn't sure whether the two PRs it depends on would force any changes. It seemed a little premature to flag it for full review until the custom units and per corner radii changes were merged. Hopefully those will be ready to merge in the near future. |
677a9a8
to
6408a75
Compare
6428068
to
41cb528
Compare
706321b
to
9b8f2c7
Compare
41cb528
to
f276e8c
Compare
I've rebased and re-tested this PR after recent changes to #31641. It still works for me. |
f276e8c
to
1dc8a7e
Compare
c79a569
to
67e6dc8
Compare
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.
This tested well for me in editor and frontend, and the UI works well switching between multiple and single border settings and retaining mixed values in these instances, etc.
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 took the UI for a run in Chrome/FF/Safari, and the controls work and display as expected in the block editor and frontend 👍
I don't know if this PR should be concerned or whether it's a theme responsibility, but I checked in a couple of themes, and in Twenty Nineteen at least, the theme styles are overriding the primary and secondary border colors (e.g., .entry .entry-content .has-primary-background-color
):
packages/block-editor/src/components/border-radius-control/utils.js
Outdated
Show resolved
Hide resolved
packages/block-editor/src/components/border-radius-control/utils.js
Outdated
Show resolved
Hide resolved
Thank you @glendaviesnz & @ramonjd for the reviews 👍
This PR is primarily concerned with the UI around the existing border block support. My thinking is that it will be best to keep the border block support consistent with other block support features in terms of style specificity. If there is a particular reason the TwentyNineteen theme can't be updated to address its overwriting of border color styles, we can address it in a separate PR. I've made the requested tweaks as well as updated the border width control to use the new default step values for each unit. Let me know if I've missed anything. |
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.
Thanks for addressing those minor points, and clarifying the theme issue.
LGTM 🚀
After merging this is working well for existing blocks that leverage border support. BorderRadius-ShorthandVsLonghandStyles.mp4 |
! hasDefinedValues( values ) || ! hasMixedValues( values ) | ||
); | ||
|
||
const units = useCustomUnits( { availableUnits: [ 'px', 'em', 'rem' ] } ); |
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.
Does this need to use the spacing.units
or layout.units
available via theme.json
? I've noticed it's one of the few places where these aren't used so are not configurable by the theme.
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.
Good point.
I can see theme developers wishing to allow different units for borders to those of spacing or layouts as well. A PR allowing configuration of border units can be found in #33315.
Refine the controls provided via the border block support feature.
Part of: #31337
Related: #32080
Depends on: #31483 & #31641Description
This PR refines the border block support UI in line with #31337.
These refinements are separate to migrating the border block support to use the new progressive display panel proposed in #32392. Converting to this new panel will be best handled separately.
The condensed color control proposed in the G2 components still requires some additional dependencies being imported into Gutenberg so will also be addressed in a future PR as soon as the control is available.
How has this been tested?
Test instructions
Screenshots
Types of changes
New feature.
Checklist:
*.native.js
files for terms that need renaming or removal).