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

[AutoComplete] "openOnFocus" is defective #6659

Closed
ErreMalote opened this issue Apr 20, 2017 · 5 comments
Closed

[AutoComplete] "openOnFocus" is defective #6659

ErreMalote opened this issue Apr 20, 2017 · 5 comments
Labels
component: autocomplete This is the name of the generic UI component, not the React module!

Comments

@ErreMalote
Copy link

ErreMalote commented Apr 20, 2017

Problem description

the prop "openOnFocus" from the AutoComplete Component doesn't function as desired because the filter function doesn't take in consideration the prop.

filter: (searchText, key) => searchText !== '' && key.indexOf(searchText) !== -1,

so when the prop is true nothing really happens because the searchText == ""

Link to minimal working code that reproduces the issue

<AutoComplete openOnFocus hintText="Type anything" dataSource={ [ "exeption1","other Type", "another Type" ]} onUpdateInput={this.handleUpdateInput} />

Versions

  • Material-UI: 17.4
  • React: 15.5
  • Browser:
@mgmorcos
Copy link

+1

@ErreMalote ErreMalote changed the title "openOnFocus" from the AutoComplete is defective [AutoComplete] "openOnFocus" is defective Apr 25, 2017
@jakepanitz
Copy link

Can't you just set filter={(searchText, key) => (key.indexOf(searchText) !== -1)} to get the functionality you're looking for?

@ErreMalote
Copy link
Author

Yea that is what I did on my end. However, if someone downloads the library and tries the prop "openOnFocus" it will not work.

@jakepanitz
Copy link

So perhaps the solution would be to override the default filter with (searchText, key) => (key.indexOf(searchText) !== -1) if openOnFocus is true and no filter is provided.

@oliviertassinari
Copy link
Member

Closed by #4783

@oliviertassinari oliviertassinari added the component: autocomplete This is the name of the generic UI component, not the React module! label Apr 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: autocomplete This is the name of the generic UI component, not the React module!
Projects
None yet
Development

No branches or pull requests

4 participants