feat(components): Autocomplete Multiselect#2921
Conversation
| {isSelected && <Icon name="checkmark" size="small" />} | ||
| <div | ||
| className={styles.icon} | ||
| style={isSelected ? undefined : { visibility: "hidden" }} |
There was a problem hiding this comment.
this is an existing issue. our height isn't stable causing visible shifts when something is selected, it's just much easier to see in multiselect.
another way to deal with this would be to set a min or fixed height on the row but that gets interesting with custom content.
Deploying atlantis with
|
| Latest commit: |
0d83ea5
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://1aa34e0e.atlantis.pages.dev |
| Branch Preview URL: | https://autocomplete-multiselection.atlantis.pages.dev |
|
e2e test failures are expected. from stabilizing the height, each row now contributes more to the overall height and it's enough to trigger the diff threshold. |
… complex interactions and to enforce minimums
|
clearable looks quite bad on this branch. I broke out the fix for that in a separate PR to try and reduce the noise. ideally our visual tests catch any differences that spawn from the change that will make this work nicely here as well as everywhere else. |
|
@nad182 finally got CI green. here's the PR. |
There was a problem hiding this comment.
I might be wrong, but to me all the screenshots look the same (before/after). Not sure if that is expected. I only see that the "after" ones are 1px shorter (in height).
There was a problem hiding this comment.
Never mind. I left a comment on the commit, where there was no difference between the "deleted" and "added" screenshot. But I see the difference in the diff from master.
nad182
left a comment
There was a problem hiding this comment.
There are some issues in Storybook that I noticed:
- "With customRenderValue" example: both the close icon (X) and chevron (^) are visible next to each other. Might not be the best UI.
- If there are multiple autocompletes on one page (close to each other), the close icon has a higher z-index, so it appears "on the" top of another Autocomplete's dropdown/menu.
- Chevron doesn't change direction (not sure if that is expected, but I thought it would).
If you think it would be better to address those in the follow-up (or if they are not an issue), feel free to merge this PR!
|
@nad182 the z-index is a known issue https://jobber.atlassian.net/browse/JOB-128115 As for the cheveron changing direction it looks to be related it being a custom suffix with it as a chevron down (the default autocomplete doesn’t have the chevron. I do think the spacing between the suffix and clearable should be fixed because from what I can see it isn't using a |
|
Overall design review I'd say this is mostly g2g considering the other issues called out above are known issues that apply to all fields, so I think those are fine to sort out outside of this. I say mostly because I honestly totally missed the chevron staying the same direction (good callout!!) but after a quick sanity check around other libraries it does look like most change directions between the open and close state and that just makes sense for those icons in general (chevrons should point the direction they're going) so I think that would be a good thing for us to include as well. Otherwise this LGTM! |
fair enough. I'll add an example, though we won't have as much control as we might like to say use an animated rotation rather than a more abrupt icon swap. oh wait, whoops I neglected to implement ok added those, and an example now. |
edison-cy-yang
left a comment
There was a problem hiding this comment.
Commenting on the commits that happened after Jacob's approval, without getting all the context on previous commits, they look good to me.
Only thing that caught my eyes is the naming of limitSelectionText now that it returns a ReactNode. Maybe I'm missing some context but it's not very clear to me what the prop should do based on its name.
that's fair. do you think the JSDocs are sufficient? or should I add a note saying that it must resolve to a string/text or that it must be phrasing content? the reason for accepting a ReactNode is to allow this where the |
|
@edison-cy-yang forgot to tag you on the above |
I think adding a note saying it needs to resolve to phrasing content would be great. |
|
@edison-cy-yang added some additional context in the JSdoc |

Motivations
Multiselect on Autocomplete is something we want to offer. it becomes a replacement for MultiSelect, Chips (dismissible) and overall can meet UX needs that Combobox is not suited for.
The particular case we have in mind right now is a team selection UX.
the foundations and bones for multiselect are already in place, it's a matter of sorting out some remaining details, polishing the experience for this flow, and adding a few new features that increase the usability of the component when selecting multiple.
Changes
Added
onBlurto fire)customRenderValueprop that can be used to customize the appearance of a selected value (multiple only)Changed
useEffecthooks for a more event-driven approach to make it easier to folowDeprecated
Removed
Fixed
snuck in a fix to a single character deletion bug that can result in your options getting out of sync due to the debounce.
Security
Testing
set up some
multipleAutocompletes with various combinations including customizing the selection display, play around with it and make sure you like how it feels and behaves!Changes can be
tested via Pre-release
In Atlantis we use Github's built in pull request reviews.