diff --git a/CodeBeam.MudBlazor.Extensions/Components/ComboBox/MudComboBox.razor.cs b/CodeBeam.MudBlazor.Extensions/Components/ComboBox/MudComboBox.razor.cs index c874f371..11262c03 100644 --- a/CodeBeam.MudBlazor.Extensions/Components/ComboBox/MudComboBox.razor.cs +++ b/CodeBeam.MudBlazor.Extensions/Components/ComboBox/MudComboBox.razor.cs @@ -1196,6 +1196,9 @@ public override async Task ForceUpdate() /// protected async Task ClearButtonClickHandlerAsync(MouseEventArgs e) { + if (Disabled || ReadOnly) + return; + await UpdateComboBoxValueAsync(default); _searchString = null; await SetTextAsync(default, false); @@ -1216,6 +1219,9 @@ protected async Task ClearButtonClickHandlerAsync(MouseEventArgs e) /// public async Task Clear() { + if (Disabled || ReadOnly) + return; + await SetValueAsync(default, false); _searchString = null; await SetTextAsync(default, false); diff --git a/CodeBeam.MudBlazor.Extensions/Components/InputExtended/MudInputExtended.razor.cs b/CodeBeam.MudBlazor.Extensions/Components/InputExtended/MudInputExtended.razor.cs index 36494863..4caf374b 100644 --- a/CodeBeam.MudBlazor.Extensions/Components/InputExtended/MudInputExtended.razor.cs +++ b/CodeBeam.MudBlazor.Extensions/Components/InputExtended/MudInputExtended.razor.cs @@ -1,6 +1,4 @@ -using System; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Components; +using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; using Microsoft.JSInterop; using MudBlazor; @@ -252,6 +250,9 @@ protected override async Task UpdateValuePropertyAsync(bool updateText) protected virtual async Task ClearButtonClickHandlerAsync(MouseEventArgs e) { + if (Disabled || ReadOnly) + return; + await SetTextAsync(string.Empty, updateValue: true); await ElementReference.FocusAsync(); await OnClearButtonClick.InvokeAsync(e);