Skip to content

fix: [what is the issue?] in [where is the issue?] #2846

@gsnyder87

Description

@gsnyder87

🐛 Bug Report

The fluentNumberField immediate delay does not work when using the up and down arrows.

💻 Repro or Code Sample

🤔 Expected Behavior

the up and down arrows should work the same was an inputting text into the field does.

😯 Current Behavior

when using the up and down arrows, the OnValueChanged method is hit immediately.

💁 Possible Solution

I have a page level workaround, but it would be nice if this was within the component itself.

@page "/counter"

Counter

Counter

@code {
private System.Timers.Timer _timer;
private decimal? _latestValue;

public Counter()
{
    _timer = new System.Timers.Timer(1000); // 1 second delay
    _timer.Elapsed += OnTimerElapsed;
    _timer.AutoReset = false;
}

private void OnValueChanged(decimal? value)
{
    _latestValue = value;
    _timer.Stop();
    _timer.Start();
}

private void OnTimerElapsed(object sender, System.Timers.ElapsedEventArgs e)
{
    InvokeAsync(() => OnValueChanedAction(_latestValue));
}

private void OnValueChanedAction(decimal? value)
{
    Console.WriteLine(value);
}

}

🔦 Context

when users hit the arrows too fast, it triggers the ValueChanged resulting in changes too fast to the page which gets us into a code loop.

🌍 Your Environment

  • OS & Device: [e.g. MacOS, iOS, Windows, Linux] on [iPhone 7, PC]
  • Browser [e.g. Microsoft Edge, Google Chrome, Apple Safari, Mozilla FireFox]
  • .NET and Fluent UI Blazor library Version [e.g. 8.0.2 and 4.4.1]

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageNew issue. Needs to be looked at

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions