-
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
Fix: Add the border width on initial color change for border #69112
base: trunk
Are you sure you want to change the base?
Conversation
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
const hasZeroWidth = widthValue === 0; | ||
// If widthValue is 0, or on initial render we have width undefined. | ||
// Need to set width to `1px`, if we change color first before adding border width. | ||
const hasZeroWidth = widthValue === 0 || undefined === widthValue; |
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.
Use YODA condition:
const hasZeroWidth = widthValue === 0 || undefined === widthValue; | |
const hasZeroWidth = 0 === widthValue || undefined === widthValue; |
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.
Hi @coder-rancho, Thanks for pointing this out, but new coding standards proposes not to use Yoda Conditions
. The codebase have bunch of files that are not using Yoda conditions. I would update the PR if core team want's to use Yoda condition here.
Thank You,
What?
Fixes: #69094
undefined
on initial render to set the width to1px
for border, if user adds/changes the color before explicitly setting the width.Why?
How?
undefined
condition with the0
width check.Testing Instructions
1px
width for border.Testing Instructions for Keyboard
Screenshots or screencast
BorderFix.mov