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 with clearOnBlur doesn't clear value on blur

See original GitHub issue
  • 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 😯

Autocomplete with clearOnBlur set to true doesn’t seem to clear the value on blur.

Expected Behavior 🤔

Autocomplete with clearOnBlur set to true clears the value on blur.

Steps to Reproduce 🕹

Can be reproduced on the official playground, see https://material-ui.com/components/autocomplete/#playground. I have also created a codesandbox example here.

Steps:

  1. Open an autocomplete with clearOnBlur set to true
  2. Select an option
  3. Click outside to blur the autocomplete
  4. The selected value doesn’t get cleared

Context 🔦

Your Environment 🌎

Tech Version
Material-UI v4.9.13
Material-UI lab 4.0.0-alpha.52
React v16.9.0
Browser All
TypeScript 3.6.2
etc.

Thank you for your help! 🙂

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
oliviertassinaricommented, May 15, 2020

@MargaretKrutikova You could control the inputValue state, clear the text bases on the events you need. @JitendraBhamidipati thanks for the help 🙏.

1reaction
MargaretKrutikovacommented, May 14, 2020

Yes, exactly. When the user selects the value, we add it as a row in a table under it (with recalculating some values), but don’t want to actually show anything as selected. Appreciated help on this! 🙂

Read more comments on GitHub >

github_iconTop Results From Across the Web

Autocomplete with clearOnBlur doesn't clear value on blur
Open an autocomplete with clearOnBlur set to true · Select an option · Click outside to blur the autocomplete · The selected value...
Read more >
Material UI Autocomplete clearOnBlur clears when false
Show activity on this post. In a recent project, I am using Material UI's Autocomplete. There I do not want the input field...
Read more >
AutoComplete - Ant Design
AutoComplete is an input box with text hints, and users can type freely. The keyword is aiding input. Select is selecting among given...
Read more >
Autocomplete API - Material UI - MUI
Name Type Default options * array renderInput * func autoComplete bool false
Read more >
react hook form onblur not working - You.com | The AI Search ...
In your code, the form mode is onBlur . it means the validation is triggered on blur event (unfocus the input). When you...
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