Skip to content
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

[Combo box] Allow filtering or hide non-matching options #4468

Closed
shixiedesign opened this issue Oct 26, 2019 · 2 comments
Closed

[Combo box] Allow filtering or hide non-matching options #4468

shixiedesign opened this issue Oct 26, 2019 · 2 comments

Comments

@shixiedesign
Copy link
Contributor

shixiedesign commented Oct 26, 2019

Allow filtering (or hide non-matching options) for Combo box

Current

Right now combo box does not hide options that do not match user input text. To increase usibility, component should reduce the number of options when user input some text to only the matching ones.

image

Ideal state + justifications

Country selection is a common use case for combo box. Number of countries make the dropdown extremely long and difficult to use. Allowing type in + filtering helps to bring all the relevant options into view, hide all the other options. If there is no filtering in below example, users can miss out on the existence of other matching options below the fold.

Notice the blue text highlighting is a nice to have enhancement.

image

Research / academic backup

https://baymard.com/blog/drop-down-usability

@shixiedesign shixiedesign changed the title [Combo box] Filtering + Text highlighting [Combo box] Allow filtering (or hide non-matching options) Oct 28, 2019
@shixiedesign shixiedesign changed the title [Combo box] Allow filtering (or hide non-matching options) [Combo box] Allow filtering or hide non-matching options Oct 28, 2019
@guigueb
Copy link
Contributor

guigueb commented Mar 24, 2021

I think this one can be closed.
I'm not sure when shouldFilterItem was added but I think it will do what this enhancement is wanting.

/**

  • Specify your own filtering logic by passing in a shouldFilterItem
  • function that takes in the current input and an item and passes back
  • whether or not the item should be filtered.
    */
    shouldFilterItem: PropTypes.func,

@tw15egan
Copy link
Member

As @guigueb pointed out, it seems like this functionality has been included in ComboBox at least dating back to the beginning of the monorepo: commit

A possible future enhancement would be adding color highlighting to the filtered results, but I believe that should be captured in a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants