-
Notifications
You must be signed in to change notification settings - Fork 49
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
feat: add multi-select capabillity to AutocompleteWithSuggestions #975
Conversation
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.
Nice! I like how the default props make it easier to use the component.
@thomasguillot One thing I should mention is that I deviated slightly from your design mockup with the selected items here: In your mockup: In the implemented version, we group all selections together regardless of their post type. I found that grouping different post types into separate sections was causing the selection area to be very tall if more than one post type is selected, and also caused a lot of screen jitter when post type sections get added or removed. |
@adekbadek I've been testing this component with a Newspack Listings feature and doing so has uncovered a few bugs/shortcomings in the component as you reviewed it. Here's a summary in case you want to re-test and/or re-review:
To test (1), you can pass in a
Make sure the logged params match the component's state (tokenfield search term, To test (2), pass in an
Select items by clicking them from the suggestion list and selecting them from the autocomplete search results. Confirm that each item in the array contains both the item's |
I've been using the component from this branch in Campaigns, Listings, and Blocks for several days now without issue, so I'm going to go ahead and merge/publish to NPM. If any further bugs or features need to be addressed, we can do that in additional and smaller PRs. Thanks to both of you for your reviews, @thomasguillot and @adekbadek! |
# [1.42.0-alpha.1](v1.41.0...v1.42.0-alpha.1) (2021-06-01) ### Features * add multi-select capabillity to AutocompleteWithSuggestions ([#975](#975)) ([d7aebe2](d7aebe2))
🎉 This PR is included in version 1.42.0-alpha.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
🎉 This PR is included in version 1.42.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
All Submissions:
Changes proposed in this Pull Request:
This complete the
AutocompleteWithSuggestions
component to add multi-select capability. This is needed for the proposed child listings UI design in Newspack Listings.Closes #954.
How to test the changes in this Pull Request:
AutocompleteWithSuggestions
component: the first is single-select (unchanged frommaster
), the second is multi-select with checkboxes instead of links.master
, except that the selected item is now shown at the top of the component separate from the autocomplete field, which is now only used for search functionality:suggestionsToFetch
prop (default: 10), a "Load more" button will appear at the end of the suggestions list. Clicking this button will loadsuggestionsToFetch
more posts until all posts of the selected post type are loaded.Other information: