add a disableTags prop for Autocomplete
See original GitHub issueI’m not sure that is this a feature request or a bug fix
in this example of Autocomplete component you used renderTags={() => null}
to disable showing tags but when we do this tags will not be disabled completely and the handleKeyDown
listener will be attached to component which cause removing selected elements using backspace in search box which is not which we need in this example
I think adding a disableTag={true}
prop to AutoComplete component would be a good solution
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:11 (7 by maintainers)
Top Results From Across the Web
add a disableTags prop for Autocomplete #21333 - GitHub
bug Something isn't working component: autocomplete This is the name of the generic UI component, not the React module! good first issue ...
Read more >A Guide on Material UI AutoComplete in React - Refine Dev
When you add the freeSolo prop to the <Autocomplete /> component, it enables the text field to accept undetermined values.
Read more >How can I add unique keys to React/MUI Autocomplete ...
If it still doesn't work, check your props order, you need to declare the key prop ... Then it will be overridden by...
Read more >How to Use The Autocomplete Component in Material-UI
The Material-UI docs describe the autocomplete as “a normal text input ... Then, in the Autocomplete component, we can add two more props....
Read more >React Autocomplete component - Material UI - MUI
The autocomplete is a normal text input enhanced by a panel of suggested ... The prop is designed to cover the primary use...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@MHA15 Thanks for raising, this is concerning:
TypeError: Cannot read property 'focus' of null
I think that the rendering logic of
useAutocomplete
should be more resilient, it should support missing tags. While I appreciate your proposal arounddisableTag
, if feels that it’s something that is specific to the Autocomplete component. If we can get the same outcome withrenderTags={() => null}
, I think that we should rather go in this direction, it’s more explicit.What do you think of this fix, considering a missing item as disabled? Do you want to work on a pull request? We would also need a regression test 😃.
Just submitted a pr based off of your suggestion @oliviertassinari, does anyone have any advice on mastering the material-ui codebase? https://github.com/mui-org/material-ui/pull/21460