question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Autocomplete] shows zero[0] in input when we clear the input programmatically

See original GitHub issue

In some cases after I select suggestion 0 appears in the input and kinda breaks the process.

  • The issue is present in the latest release.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Current Behavior 😯

I use inputValue/onInputChange because I want let user to also add custom values so I enabled freeSolo and filterOptions, hence the typing value should be controlled and I should clear it whenever I want. Now the problem is with this set-up when I select an option and then I delete it, after re-selecting it the value 0 will be shown in the input and it kinda breaks after that.

Expected Behavior 🤔

I should be able to re-select a value as many as I want.

Steps to Reproduce 🕹

Here is link to CodeSandBox (freeSolo and filterOptions are not enabled for simplicity)

Steps:

  1. Select Radiohead for instance.
  2. Click on Radiohead to delete it.
  3. Re-select Radiohead and you’ll see the problem

Context 🔦

Tech Version
Material-UI v4.9.10
Material-lab 4.0.0-alpha.49
React 16.13.1
Browser Chrome / Firefox
TypeScript No

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
oliviertassinaricommented, Apr 18, 2020

@erfansamieyan You need to control the value too, to clear it.

0reactions
erfooncommented, Apr 18, 2020

@oliviertassinari Yes you’re right. I had to add a new state and pass to component only for making it clear. It’s working now. Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

[Autocomplete] shows zero[0] in input when we clear ... - GitHub
In some cases after I select suggestion 0 appears in the input and kinda breaks the process. The issue is present in the...
Read more >
vue.js - Vuetify clear autocomplete input programmatically
I'd would like to reset the autocomplete input with another btn like this pen instead of the clearable btn. I tried to add:...
Read more >
How to turn off form autocompletion - Web security | MDN
This article explains how a website can disable autocomplete for form ... You can do this either for an entire form, or for...
Read more >
How To Turn Off Autocomplete for Input - W3Schools
Learn how to disable autocomplete of an input field. Turn Off Autocomplete. Use the autocomplete attribute to turn off autocomplete for input fields: ......
Read more >
HTML Standard
The value, along with the " = " character, can be omitted altogether if the value is the empty string. <!-- empty attributes...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found