-
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
Search Block: Add border color support #31783
Search Block: Add border color support #31783
Conversation
7f23734
to
7707b05
Compare
7707b05
to
595ba9e
Compare
@stacimc I fixed the border regression in b35d1c1ae3c942bf28155b9c8d1bb9e09296ec2e |
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 putting this one together @ramonjd 👍
This PR tests as advertised for me.
It might be good though to get a couple of sets of eyes on it regarding forming a consensus on exactly what should get the border color under what conditions.
I don't pretend to be a designer however it looks a bit odd to me to be applying the border color to the button when positioned inside but not the input. I'd be inclined to omit the button border color in that situation. It would also simplify a lot of the changes required to add border color to the block.
Also, when checking this out I see a number of PHP linting errors for =
alignment in index.php
.
That aside, this is looking good ✨
Thanks @aaronrobertshaw. That's a fair point. I wasn't sure of it myself. I think my logic was that the border radius was being applied to the button as well, so I thought it might be odd to have the color as an exception. Happy to go in either direction if we get some extra feedback.
That's just me trying to annoy the linter as much as it annoys me. 😆 Fixed |
We could go the other way and apply the border color to the input as well. Same degree of simplification in the code. My personal preference would be to leave it only on the wrapper when the button is inside. It gets pretty busy looking otherwise. |
This tests well for me as well!
+1 now that you point it out -- I'm thinking this would be exacerbated if border width or style options are added, too. 🤔 |
193b4e8
to
6dfcadb
Compare
@aaronrobertshaw @stacimc Thanks for the feedback! I've adjusted things so that the border color is applied to the input and button elements only when the button is outside. When the button is inside, only the wrapper gets the color. |
c153b8e
to
d7ea26b
Compare
d7ea26b
to
9ff8799
Compare
I think this one is ready for some more 👀 @jasmussen or @aaronrobertshaw Do you see any issues with the controls in light of the UI updates? Should we hold off? This introduces the border color control only. |
Thanks for all your work on this @ramonjd 👍 While this does only introduce the border color control, there is also the existing border radius control. Work being done on improving the border support UI ( #31585 ) though it needs a little more time before it lands. It might also be desirable that the border support UI be updated with a new progressive disclosure approach similar to #32392. I'll defer to @jasmussen regarding what's acceptable in terms of UI and this landing. On the code front, I'll give it a proper review later today. |
Thanks for the ping. This is what I see: These are some nice features, excited for them to land. Aaron also makes some good points on using the progressive discovery panel, adopting Jay's style picker and unifying on a "Border" panel. Here's a quick doodle that includes some of Jay's work, but for the Search block: While that mockup is a bit forward looking (it's also a work in progress, and CC @javierarce as I know he's been working on Search block improvements as well) — there are a few details and principles I think are important:
Landing #31585 first would also be of huge value. While the progressive discovery panel would also benefit things, one of the aspects of the Search block currently is that there aren't that many properties to configure, so it's okay to just show all of them by default. Progressive discovery will enable that to scale better, of course, but I don't think it a blocker here. So what do we need to do?
It's unrelated to this PR, but the "Display Settings" panel is just a "Dimensions" panel. |
Great feedback as always @jasmussen, thank you 🙇
I appreciate the "Display Settings" panel wasn't added in this PR but there's no harm in removing the word settings which also then removes one title case inconsistency. The "settings" in the border panel comes from the current border block support UI which is cleaned up as part of #31585.
#31585 is getting much closer to landing as the PR it depends on should get merged some time in the next week, or few days, if we're lucky.
The new progressive discovery panel is close however will need a little additional work once it lands to update the border block support to use it.
Both the new progressive discovery panel and the refinements in #31585 will be automatically picked up by the search block once they land. No further tweaks should be required.
This is included in #31585.
At present, the default open/closed state of the border support panel is a simple boolean value. It is either open by default for all blocks or none. I don't think we want it open by default for all blocks for the time being. When the progressive discovery panel lands we'll get the ability to display different controls by default for different blocks. |
I mean this "Border settings" one: to be like this: Or did you mean that if that panel is set to be open by default, it's open by default for any block that includes the border support? Like the group? In that case, yes, let's keep it collapsed until it's progressive and we can choose some good defaults. Perhaps with a new color picker as well. |
This one. If we open that panel by default, all blocks that opt into border support, such as the group block, will also have the panel open by default. That panel comes straight from the border block support. No UI has been directly "added" as part of this PR. This is also why as soon as #31585 that refines that panel lands, this search block immediately benefits from it. Likewise, once the border block support gets the progressive discovery panel, it will show immediately for the search block.
Great. That's one less tweak required to this PR. It now appears everything else on the earlier "todo list" is covered by #31585. As the search block already has the border support panel displaying the border radius control, could this PR land now? Or can we hold off until #31585 merges? |
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 again @ramonjd for getting this PR together.
The code side is looking pretty good ✨
I have a couple of minor thoughts that might help ourselves in the future.
Could we make what's happening in the edit.js
a little clearer by replacing the repeated ternary statements with named variables instead?
Also, there could be an opportunity to simply reuse the borderProps.style
rather than rebuild the { borderRadius, borderColor }
style object a few times. It would also then pick up other border support styles such as width and border style when/if they get adopted.
I don't have strong feelings so I'll leave that one with you.
Ideally we can address the items spread across a few todos before the next plugin release, and if that's the case, it definitely seems fine to merge with the pending PRs landing after. |
Thanks a lot for the feedback and context surrounding block controls UI progress @aaronrobertshaw and @jasmussen, Very helpful!
🚀
Thanks for the nudge. I'll refactor in line with your suggestions 👍 |
cf1f416
to
d5889d9
Compare
d5889d9
to
deca258
Compare
Rebased on trunk to include changes in Search: Update search block to handle per corner border radii #33023 |
deca258
to
994ca81
Compare
Adding block supports for border color. Ensuring that classes and styles are added to the correct elements when the button is inside.
Only apply border color to the input and button elements when the button is outside. When the button is inside, we apply the border color styles to the outer wrapper. Declaring variables for button positions to avoid repetition Applying `borderProps.style` to the text field and button when the button is not inside so we can ensure that all future supports styles such as border width and style are applied to the element.
b0f934a
to
7216b7f
Compare
Rebased to include #33376 @aaronrobertshaw I think this is good to go. What do you think? |
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 is working as advertised for me 👍
✅ Code looks good
✅ Search block tests well in the editor, applying styles and classes as appropriate
✅ Search block displays correctly on the frontend
✅ No changes to previous styles or markup requiring deprecations
✅ No errors when loading deprecated versions of the search block
I think we're good to merge this. Nice work @ramonjd!
Description
This PR add border color support to the search block pursuant to #22071
We're skipping serialization since the targets for border classnames and custom styles change according to the search block style, that is, whether the button appear inside the border or not.
How has this been tested?
Manually for now.
To test, enable
customColor
in the(experimental-)theme.json
:Please check that the editor and frontend match for:
border.customRadius
in the(experimental-)theme.json
and ensure there are no regressions.Screenshots
Button inside
Button outside
Button icon
Checklist:
*.native.js
files for terms that need renaming or removal).