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] Missing support for limitTags={0} #20815
Comments
I don't think that it matters, I'm closing, prefer -1. |
@oliviertassinari Sorry,I did not express clearly.I means, does Autocomplete support maximum number of tag of 0. |
@tykdn Thanks for the clarification. What do you think of this fix? Do you want to submit a pull request? :) diff --git a/packages/material-ui-lab/src/Autocomplete/Autocomplete.js b/packages/material-ui-lab/src/Autocomplete/Autocomplete.js
index f6c58d99a..cd9a300cb 100644
--- a/packages/material-ui-lab/src/Autocomplete/Autocomplete.js
+++ b/packages/material-ui-lab/src/Autocomplete/Autocomplete.js
@@ -350,7 +350,7 @@ const Autocomplete = React.forwardRef(function Autocomplete(props, ref) {
if (limitTags > -1 && Array.isArray(startAdornment)) {
const more = startAdornment.length - limitTags;
- if (limitTags && !focused && more > 0) {
+ if (!focused && more > 0) {
startAdornment = startAdornment.splice(0, limitTags);
startAdornment.push(
<span className={classes.tag} key={startAdornment.length}> |
@oliviertassinari Yes, the fix looks good,I am glad to submit a pull request:). |
In the api document,'the maximum number of tags that will be visible when not focused. Set -1 to disable the limit'. But I set 0 also disable the limit.Dose the limitTags api support value of 0.
Thanks!
The text was updated successfully, but these errors were encountered: