Repository: MudBlazor/MudBlazor (2026-04-02T11:32:00Z)

Issue:
Add OnDebounceIntervalElapsed to remaining components that implement DebounceInterval
### Feature request type

Enhance component

### Component name

MudAutocomplete

### Is your feature request related to a problem?

There is an inconsistency in the usage of OnDebounceIntervalElapsed across components. Specifically, if a component supports the DebounceInterval property, it should also support the OnDebounceIntervalElapsed event. For example, MudTextField provides access to both DebounceInterval and OnDebounceIntervalElapsed, whereas MudAutocomplete only exposes DebounceInterval.

### Describe the solution you'd like

Align the behaviour of the components so that they are consistent in their support for both DebounceInterval and OnDebounceIntervalElapsed.

### Have you seen this feature anywhere else?

_No response_

### Describe alternatives you've considered

_No response_

### Pull Request

- [X] I would like to do a Pull Request

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct


Discussion:
👋 Thanks for wanting to do a PR @BieleckiLtd !
We suggest that you wait for an answer from @MudBlazor/contribution-team @MudBlazor/core-team . Otherwise we can not guarantee that your PR will be merged. As the library grows, we have to be very strict what PRs we can accept.



Patch:
diff --git a/src/MudBlazor/Components/Autocomplete/MudAutocomplete.razor.cs b/src/MudBlazor/Components/Autocomplete/MudAutocomplete.razor.cs
index bfbf72172e8e..dee9569db622 100644
--- a/src/MudBlazor/Components/Autocomplete/MudAutocomplete.razor.cs
+++ b/src/MudBlazor/Components/Autocomplete/MudAutocomplete.razor.cs
@@ -270,6 +270,15 @@ protected string GetListItemClassname(bool isSelected) =>
         [Category(CategoryTypes.FormComponent.Behavior)]
         public int DebounceInterval { get; set; } = 100;
 
+        /// <summary>
+        /// Occurs when the <see cref="DebounceInterval"/> has elapsed.
+        /// </summary>
+        /// <remarks>
+        /// The current value of <see cref="MudBaseInput{T}.Text"/> is included in this event.
+        /// </remarks>
+        [Parameter]
+        public EventCallback<string> OnDebounceIntervalElapsed { get; set; }
+
         /// <summary>
         /// The custom template used to display unselected items.
         /// </summary>
@@ -643,7 +652,12 @@ protected override async Task UpdateValuePropertyAsync(bool updateText)
                 _debounceTimer = TimeProvider.CreateTimer(OnDebounceComplete, null, TimeSpan.FromMilliseconds(DebounceInterval), Timeout.InfiniteTimeSpan);
         }
 
-        private void OnDebounceComplete(object? stateInfo) => InvokeAsync(OpenMenuAsync);
+        private void OnDebounceComplete(object? stateInfo)
+            => InvokeAsync(async () =>
+            {
+                await OnDebounceIntervalElapsed.InvokeAsync(ReadText);
+                await OpenMenuAsync();
+            });
 
         private void CancelToken()
         {


Test patch:
diff --git a/src/MudBlazor.UnitTests.Viewer/TestComponents/Autocomplete/AutocompleteStates.razor b/src/MudBlazor.UnitTests.Viewer/TestComponents/Autocomplete/AutocompleteStates.razor
index 1e54c4ca72a9..5e1363def665 100644
--- a/src/MudBlazor.UnitTests.Viewer/TestComponents/Autocomplete/AutocompleteStates.razor
+++ b/src/MudBlazor.UnitTests.Viewer/TestComponents/Autocomplete/AutocompleteStates.razor
@@ -3,7 +3,8 @@
 <MudAutocomplete id="autocompleteLabelTest" T="string?" Label="US States"
                  @bind-Value:get="Value" @bind-Value:set="ValueChanged" ResetValueOnEmptyText="ResetValueOnEmptyText"
                  SearchFunc="@SearchStates" DebounceInterval="DebounceInterval"
-                 CoerceText="CoerceText" CoerceValue="CoerceValue" Immediate="Immediate"/>
+                 CoerceText="CoerceText" CoerceValue="CoerceValue" Immediate="Immediate"
+                 OnDebounceIntervalElapsed="OnDebounceIntervalElapsed" />
 
 @code {
     public static string __description__ = "Autocomplete to input a US state";
@@ -29,6 +30,9 @@
     [Parameter]
     public bool Immediate { get; set; }
 
+    [Parameter]
+    public EventCallback<string> OnDebounceIntervalElapsed { get; set; }
+
     public int SearchFuncCallCount { get; private set; }
 
     private readonly string[] _states =
diff --git a/src/MudBlazor.UnitTests/Components/AutocompleteTests.cs b/src/MudBlazor.UnitTests/Components/AutocompleteTests.cs
index 8e86b35a5bbd..a0eb8f2bc117 100644
--- a/src/MudBlazor.UnitTests/Components/AutocompleteTests.cs
+++ b/src/MudBlazor.UnitTests/Components/AutocompleteTests.cs
@@ -343,6 +343,42 @@ public async Task OnTextChanged_CoerceValueAndNotCoerceTextAndImmediateAndDeboun
             valueChangedCount.Should().Be(1);
         }
 
+        [Test]
+        public async Task OnTextChanged_WithDebounce_InvokesOnDebounceIntervalElapsed()
+        {
+            // Arrange
+
+            var debouncedText = string.Empty;
+            var debounceElapsedCount = 0;
+
+            var comp = Context.Render<AutocompleteStates>(parameters =>
+            {
+                parameters.Add(p => p.DebounceInterval, 500);
+                parameters.Add(p => p.CoerceText, false);
+                parameters.Add(p => p.CoerceValue, true);
+                parameters.Add(p => p.Immediate, true);
+                parameters.Add(p => p.OnDebounceIntervalElapsed, value =>
+                {
+                    debouncedText = value;
+                    debounceElapsedCount++;
+                });
+            });
+
+            var autocompleteComp = comp.FindComponent<MudAutocomplete<string>>();
+
+            // Act
+
+            await comp.Find("input").InputAsync("Al");
+
+            // Assert
+
+            debounceElapsedCount.Should().Be(0);
+            await autocompleteComp.WaitForAssertionAsync(() => debounceElapsedCount.Should().Be(1), TimeSpan.FromSeconds(5));
+            await autocompleteComp.WaitForAssertionAsync(() => autocompleteComp.Instance.Open.Should().BeTrue(), TimeSpan.FromSeconds(5));
+            debounceElapsedCount.Should().Be(1);
+            debouncedText.Should().Be("Al");
+        }
+
         [Test]
         public async Task CoerceValueAndNotCoerceTextAndNotImmediate_ValueSetOnBlur()
         {