From eaa29c7a2896165bdc8877d00560b953e9e909c7 Mon Sep 17 00:00:00 2001 From: Jeffrey Jangli Date: Wed, 25 Oct 2023 15:52:04 +0200 Subject: [PATCH] Fixed #320 --- .../Components/ComboBox/MudComboBox.razor.cs | 6 ++++++ .../Components/InputExtended/MudInputExtended.razor.cs | 7 ++++--- 2 files changed, 10 insertions(+), 3 deletions(-) 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);