diff --git a/src/Core/Components/List/FluentAutocomplete.razor b/src/Core/Components/List/FluentAutocomplete.razor index 2469c64637..e4db983bd0 100644 --- a/src/Core/Components/List/FluentAutocomplete.razor +++ b/src/Core/Components/List/FluentAutocomplete.razor @@ -26,7 +26,7 @@ aria-label="@GetAutocompleteAriaLabel()" Value="@ValueText" @onclick="@OnDropDownExpandedAsync" - @oninput="@InputHandlerAsync" + @oninput="@InputHandlerAsync" autofocus="@Autofocus" Style="@ComponentWidth"> @* Selected Items *@ @@ -68,7 +68,7 @@ } } - @if (!Disabled) + @if (!Disabled && !ReadOnly) { if (this.SelectedOptions?.Any() == true || !string.IsNullOrEmpty(ValueText)) { @@ -205,12 +205,22 @@ { var text = @GetOptionText(item); - - @text - + if (ReadOnly || Disabled) + { + + @text + + } + else + { + + @text + + } } else { diff --git a/src/Core/Components/List/FluentAutocomplete.razor.cs b/src/Core/Components/List/FluentAutocomplete.razor.cs index 8b72646e07..3f128629ca 100644 --- a/src/Core/Components/List/FluentAutocomplete.razor.cs +++ b/src/Core/Components/List/FluentAutocomplete.razor.cs @@ -265,6 +265,11 @@ private string ComponentWidth /// protected override async Task InputHandlerAsync(ChangeEventArgs e) { + if (ReadOnly || Disabled) + { + return; + } + ValueText = e.Value?.ToString() ?? string.Empty; await RaiseValueTextChangedAsync(ValueText);