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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clearing the text in Autocomplete Search make auto complete unusable. #18169

Closed
kennethmervin01 opened this issue Nov 4, 2019 · 1 comment 路 Fixed by #18285
Closed

Clearing the text in Autocomplete Search make auto complete unusable. #18169

kennethmervin01 opened this issue Nov 4, 2019 · 1 comment 路 Fixed by #18285
Assignees
Labels
component: autocomplete This is the name of the generic UI component, not the React module! new feature New feature or request

Comments

@kennethmervin01
Copy link

kennethmervin01 commented Nov 4, 2019

Current Behavior 馃槸

I just want to clear the text field area when I hit some button or state changes. Actually I'm reading the documentation of Autocomplete API and there is no option to do that.

So what I did is every time the text field changes the props.value of auto complete changes. So I can easily set a "blank" value in state to clear the textfield area. But the problem is the auto complete search is not working it's just list all the items.

Expected Behavior 馃

I want is to clear the text field area when I hit the button submit. Actually I'm reading the documentation of Autocomplete API and there is no option to do that.

Steps to Reproduce 馃暪

   <Autocomplete
      freeSolo
      value={value}
      options={top100Films.map(option => option.title)}
      onChange={handleChange}
      renderInput={params => (
        <InputBase
          {...params}
          fullWidth
          InputProps={{
            ...params.InputProps,
            type: 'search',
          }}
          onChange={(e) => {
            onChange(e.target.value);
          }}
          value={value}
        />
      )}
    />
@oliviertassinari oliviertassinari added the component: autocomplete This is the name of the generic UI component, not the React module! label Nov 4, 2019
@oliviertassinari oliviertassinari added the good first issue Great for first contributions. Enable to learn the contribution process. label Nov 4, 2019
@oliviertassinari
Copy link
Member

We might have a good solution proposal in #18113 (comment).

@oliviertassinari oliviertassinari self-assigned this Nov 9, 2019
@oliviertassinari oliviertassinari added new feature New feature or request and removed good first issue Great for first contributions. Enable to learn the contribution process. labels Nov 9, 2019
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! new feature New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants