-
Notifications
You must be signed in to change notification settings - Fork 215
SearchListControl: Fix preserving case of original item
#6551
SearchListControl: Fix preserving case of original item
#6551
Conversation
Script Dependencies ReportThe
This comment was automatically generated by the |
|
Size Change: +102 B (0%) Total Size: 873 kB
ℹ️ View Unchanged
|
Aljullu
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.
This is testing well and code looks good, thanks for fixing this @sunyatasattva!
I'm pre-approving, but I left a comment about whether we should import from react or from @wordpress/element. It looks like the way this PR is done, it's currently adding the react dependency to several scripts.
| * External dependencies | ||
| */ | ||
| import { groupBy, keyBy } from 'lodash'; | ||
| import { Fragment } from 'react'; |
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.
I'm a bit confused by this now, but I thought we always wanted to prioritize importing from @wordpress/element instead of react.
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.
Oh thanks for pointing that out @Aljullu! I wasn't aware of that. Perhaps it's something we could write somewhere? Team Handbook? READMEs?
I'll fix it and merge it! Thanks for the review! 🙏
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.
Oh thanks for pointing that out @Aljullu! I wasn't aware of that. Perhaps it's something we could write somewhere? Team Handbook? READMEs?
Sounds good, I agree. Is that something you can own or create an issue with the documentation label?
Searches would keep the case of the user input instead of the original case of the name.
b461883 to
afce2fd
Compare
This PR fixes an issue where the
SearchListControlcomponent (for example, used in the Hand-picked Products block) would render the search results list with highlighted text borrowing the case from the user's input instead of the original item's name. So, if the original item's name wasHoodie, but the user's input washOoDiE, search results would display the latter, rather than the former.Search still is case insensitive, but preserves the original item's case.
Also, this PR adds a test for this bug and fixes a previous test case which wasn't actually testing for this at all.
Fixes #6524
Screenshots
Testing
Automated Tests
User Facing Testing
WooCommerce Visibility
Performance Impact
Changelog