-
Notifications
You must be signed in to change notification settings - Fork 843
Subscribe block: Add sync between button background color and border color #22949
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
Subscribe block: Add sync between button background color and border color #22949
Conversation
The commit introduces `useEffect()` that automatically sets the `borderColor` to the currently set `buttonBackgroundColor`. The `borderColor` is set only if the `borderColor` hasn't been set before.
|
Caution: This PR has changes that must be merged to WordPress.com |
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped. Jetpack plugin:
|
The new condition makes sure the border color is changed if and only if: - both colors (border and button background color) are the same currently, and: - the new color we are setting the button background color to isn't the same as the current border color
|
In general, the code works and the automation is nice, but it raises some questions:
|
|
Just another test on setting custom border color & custom background color. This is OK. |
Yes, that's right. The idea is to automate the border color change only if the colors are the same. If the user changes the border color to some other color than the current background color, the color sync "is disabled" and additional changes to the background color won't affect the set border color. This way, the user won't lose their custom border color. At the same time there's the case you shared in your screen recording: https://user-images.githubusercontent.com/1287077/155081591-4d28914a-1013-41e6-91e3-903edf4cd6ba.mp4. Thank you for catching that, Yan! When both colors are the same and the user wants to keep the border color and change only the background color, they would need to remember that border color - as if they switch the backgroud color to something else, the border color will be changed as well (as both colors were the same and color sync is "enabled"). Here's the conversation where Matiás shared the intended behavior: p1645093761706199/1645006316.158349-slack-C02TCEHP3HA. The question is now what is better from the user's perspective. 🤔 |
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.
Although I have a small usability concern (over the steps needed to unsync background color with the border color to change just the background colour), this PR does what it says, which is:
Setting background color automatically sets border color:
- when the border color is unset OR
- when the border color is the same color as the background color
I'll approve this, and will leave this for the 2nd round of review.
…-background-border-color-sync
|
Great news! One last step: head over to your WordPress.com diff, D75170-code, and commit it. Thank you! |
|
Successfully deployed to WPCOM. Changeset: r240597-wpcom. |
|
Thanks for working on this! We can always revise the logic but I think it covers the most common expectation of wanting background to also affect the border color. Maybe in the future we can pair this with whether compact or split is being used, though that could add another layer of hidden UX. |
The proposed changes provide an automatic border color change when the user changes the button background color.
Screen recording displaying the proposed changes in action:
Screen.Capture.on.2022-02-18.at.16-23-18.mp4
Changes proposed in this Pull Request:
The PR introduces new
useEffect()that automatically sets theborderColorto the currently setbuttonBackgroundColor.The
borderColoris set automatically if and only if theborderColorholds the same color as thebuttonBackgroundColor(including a case when the colors haven't been set yet; for instance when the block is added to the page). The condition also makes sure that if the user already set a custom color for their border manually, it won't get overridden.Jetpack product discussion
Does this pull request change what data or activity we track or use?
No, it does not.
Testing instructions: