-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Add category field block #37295
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
Add category field block #37295
Conversation
| useLayoutEffect( () => { | ||
| if ( | ||
| selectControlMenuRef.current?.parentElement && | ||
| selectControlMenuRef.current?.parentElement.clientWidth > 0 |
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 was needed as the block editor seems to render the blocks before they are being displayed on the screen, so this would return a bounding rect with width and height being zero every time.
This condition and the additional dependency below helps with this.
| value={ { | ||
| selectedTab, | ||
| postType: 'product', | ||
| postId: product.id, |
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.
exposing the postType and postId in the context as well.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## trunk #37295 +/- ##
===========================================
- Coverage 51.5% 45.8% -5.7%
+ Complexity 17283 17196 -87
===========================================
Files 430 429 -1
Lines 80037 64914 -15123
===========================================
- Hits 41216 29703 -11513
+ Misses 38821 35211 -3610
|
Test Results SummaryCommit SHA: 14be6cc
To view the full API test report, click here. To view the full E2E test report, click here. To view all test reports, visit the WooCommerce Test Reports Dashboard. |
c329a3d to
3261a05
Compare
2ca8773 to
246c77b
Compare
246c77b to
72668b4
Compare
|
Hi , @woocommerce/mothra Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
joelclimbsthings
left a comment
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.
Great work @louwie17 , working well and try as I might, I see no issues with the code.
One quick thing--the font for the popover items is 16px, while the design calls for 13px.
Also (likely just me), but if feels a bit weird that if you enter text, and then select an item that came up in search, that the text you entered is still present in the dropdown.
72668b4 to
841de2b
Compare
|
Thanks for the review @joelclimbsthings I have addressed the styling issues.
Yeah that one may be a preference thing, as this may also cause some weird behaviour if we clear it upon selection, as this would reset the search results while the popover remained open. |
joelclimbsthings
left a comment
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.
Right on, looks good @louwie17 🚢
All Submissions:
Changes proposed in this Pull Request:
This adds a new category block that is currently a wrapper around the
CategoryFieldcomponent.It also adds a new section to the product template.
Initial work on #37263
Note:
There are still some minor styling issues with the Select tree control, which will be done as follow ups:
Kapture.2023-03-17.at.15.47.59.mp4
How to test the changes in this Pull Request:
block-editor-feature-enabledOther information:
pnpm --filter=<project> changelog add?FOR PR REVIEWER ONLY: