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
Update/34885 category field in product editor #36869
Update/34885 category field in product editor #36869
Conversation
848cd21
to
ad7a400
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## trunk #36869 +/- ##
==========================================
- Coverage 51.6% 51.5% -0.0%
- Complexity 17260 17279 +19
==========================================
Files 429 430 +1
Lines 79928 79950 +22
==========================================
- Hits 41213 41211 -2
- Misses 38715 38739 +24
|
Test Results SummaryCommit SHA: 28c8964
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. |
8d7a710
to
470f1e0
Compare
448b7c1
to
9e33444
Compare
I saw these two errors at the console at some point: (trying to figure out how to reproduce, I'll edit if/when I figure it out):
|
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.
Overall feedback:
It's working well, I couldn't find any bugs while testing, besides the console error I reported in the previous comment. Congratulations, it must have been pretty hard and complex to do this!
As for the appearance, the sizing looks bigger than the rest of the elements. f.e the 30px height of the input compared to the product tags input, 20px height of the checkbox when comparing to the brand's checkbox. Some screenshots for reference:
...ins/woocommerce-admin/client/wp-admin-scripts/product-category-metabox/all-category-list.tsx
Show resolved
Hide resolved
if ( container ) { | ||
const selectedCategories = Array.from( | ||
container.querySelectorAll( ':scope > input[type=hidden]' ) | ||
).map( ( ele ) => { |
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.
'ele' is 'him' in Portuguese... That's funny. No need to change it, though 😂
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.
element
would be more readable. Or even categoryElement
.
plugins/woocommerce-admin/client/wp-admin-scripts/product-category-metabox/category-metabox.tsx
Outdated
Show resolved
Hide resolved
...woocommerce-admin/client/wp-admin-scripts/product-category-metabox/popular-category-list.tsx
Outdated
Show resolved
Hide resolved
plugins/woocommerce/client/legacy/js/admin/wc-enhanced-select.js
Outdated
Show resolved
Hide resolved
9e33444
to
5c03207
Compare
Hi @mattsherman, @nathanss, 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: |
@nathanss this should be ready for a re-review, I addressed all your changes, thanks for the initial review and sorry for the delay in updating this :) |
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.
Overall, works pretty well, though I didn't test extensively, since I spent a lot of time reviewing the code (this PR would have been nice to split up... perhaps into one that just reviewed the React component and another that focused on the integration).
@louwie17 This is a pretty impressive job... it's cool to see the existing screen being evolved with a React component. 🥳
Left a bunch of comments with suggestions for readability improvements.... most of them are just suggestions.
Functionality-wise, one change that jumped out to me was that you can't select a child without selecting the parent in the new tree. You can remove the parent from the list below the "Add category" field though, so maybe that is okay?
Echoing what @nathanss already mentioned, the font size in the new component looks too big compared with the rest of the UI it is in...
Changing the font size to 12px
results in a things looking better, though we'd also want to adjust the checkbox sizing since it still looks too big...
The case where a user enters in text into the "Add category" field that doesn't match anything feels off... I'd probably expect to be able to add a new category when I did that, instead of the field just sitting there with no indication that anything is wrong or what to do next.
plugins/woocommerce/changelog/update-34885_category_field_in_product_editor
Outdated
Show resolved
Hide resolved
if ( container ) { | ||
const selectedCategories = Array.from( | ||
container.querySelectorAll( ':scope > input[type=hidden]' ) | ||
).map( ( ele ) => { |
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.
element
would be more readable. Or even categoryElement
.
plugins/woocommerce-admin/client/wp-admin-scripts/product-category-metabox/category-metabox.tsx
Show resolved
Hide resolved
...woocommerce-admin/client/wp-admin-scripts/product-category-metabox/popular-category-list.tsx
Outdated
Show resolved
Hide resolved
plugins/woocommerce-admin/client/wp-admin-scripts/product-category-metabox/style.scss
Outdated
Show resolved
Hide resolved
plugins/woocommerce/includes/admin/meta-boxes/class-wc-meta-box-product-categories.php
Outdated
Show resolved
Hide resolved
28828b4
to
57142d2
Compare
@mattsherman thanks for the detailed review, I believe I have addressed all your feedback and fixed the font sizing issues. This PR should be ready for a re-review. |
There are a number of unresolved comments from the last time I reviewed this PR. I have went through and marked the ones that were actually resolved as resolved. It would be great to resolve those remaining unresolved comments, ideally with a short comment, so that I know you looked at the comment and considered it. Many are suggestions, so it's okay if you resolve them by saying "thanks but no thanks" 😄. I just don't want them to go unnoticed! More importantly though, there are a number of bugs I found in my latest round of testing...
Here is a video that demos the bugs... complete with a non-polished voice-over! Product.categories.bugs.mov |
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.
Found bugs that need to be addressed (see other comment).
61ee66e
to
c403fad
Compare
Thanks for taking another detailed look @mattsherman 💯
Sorry, and thanks for calling this out. I felled in a bit of a hurry (for some reason, I think before my AFK at that time), so end up only replying to a few. I believe I have addressed all your items now, and left a couple comments or responded with an Emoji :)
This was a bug with the Tree select control, I have fixed it here: 6729f4d ( I fixed the item below in this commit as well)
Yeah they had a minimum filter limit set, which was set to 3, I added a prop to manually set it and changed it to
This was an annoying one to figure out, but this was because of a
I added support for this in the tree select control by exposing a
This should be fixed now, this was a bug in the select control where @mattsherman this should be ready for a re-view assuming all the actions will pass at the time of writing this :) |
dbcdfc5
to
1a4cefd
Compare
@mattsherman I wrapped the logic in a |
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.
@louwie17 Thanks for putting this behind a feature flag.
I verified that with the feature flag disabled, the old category selector is used. With the feature flag enabled, the new category selector is used if the number of categories exceeds the threshold.
All Submissions:
Changes proposed in this Pull Request:
This updates the product category metabox with the current product editor with a react version of it that replaced the list of categories with a async search dropdown.
The async search dropdown makes use of the Tree Select Control component.
Closes #34885 .
Kapture.2023-02-21.at.16.51.21.mp4
How to test the changes in this Pull Request:
async-product-editor-category-field
feature flag using the WooCommerce Beta Tester.mu-plugin
->add_filter( 'woocommerce_product_category_metabox_search_threshold', function() { return 5; } );
Other information:
pnpm --filter=<project> changelog add
?FOR PR REVIEWER ONLY: