Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: FluentSlider's two-way data binding on Value Property does not update appropriately #1450

Closed
arazni opened this issue Feb 5, 2024 · 1 comment 路 Fixed by #1464
Closed

Comments

@arazni
Copy link

arazni commented Feb 5, 2024

馃悰 Bug Report

In my web app, I have a component that requires a slider reaches its max value, enabling a selection field, and then after a selection is made, a button triggers a command and this command also resets the value of the slider to 0.

In Fluent UI, the slider's value stays at the maximum value both as a property and visually, even though the bound data model has reset to 0.

I've prepared a demo of the problematic behaviors here: https://github.com/arazni/blazor-fluent-ui-slider-bug/tree/main

馃捇 Repro or Code Sample

Download and run the code here in dotnet 8: https://github.com/arazni/blazor-fluent-ui-slider-bug/tree/main

馃 Expected Behavior

When I click a button that resets the two-way bound value of the Slider to 0, the Slider's Value property should change to 0 and the slider should visibly appear to reset to 0.

image

Click Reset.

image

馃槸 Current Behavior

When I click a button that resets the two-way bound value of the Slider to 0, the Slider's Value property stays at its current value and the slider's visually apparent value stays at its current value.

image

Click Reset.

image

Button becomes disabled (data bound is 0, but slider is still maxed).

馃拋 Possible Solution

Fix the value-binding to respect situations where the data model's property changes, and ensure that the slider visually changes as well.

馃敠 Context

In my web app, I have a component that requires a slider reaches its max value, which enables a selection field. Once the selection field is set, a button enables that triggers a command and this command also resets the value of the slider to 0.

In the context of the web app, which is a character sheet for Blades in the Dark, when the character reaches maximum stress (the slider), they become traumatized. They select a trauma, press a button to add it, and their stress resets to 0.

馃實 Your Environment

  • OS & Device: Windows 11 PC
  • Browser at least: Microsoft Edge and Mozilla FireFox]
  • .NET 8.0.1 and FluentUI Version 4.4.0
@vnbaaij
Copy link
Collaborator

vnbaaij commented Feb 6, 2024

First, thanks for writing such a comprehensive issue report!

I got it fixed for the next release (4.4.1, later today). Turns out we were missing a current-value in the web component call.

What this dd not immediately fix was the updating of the @ref value, but by making the FluentReset method async with a tiny delay, that works then as well.

 private async Task FluentReset()
 {
     FluentModel.Reset();
     await Task.Delay(1);
     Console.WriteLine("Slider Value: " + FluentSlider!.Value);
 }

vnbaaij added a commit that referenced this issue Feb 6, 2024
vnbaaij added a commit that referenced this issue Feb 6, 2024
* Fix #1450

* Fix #1448

* Fix demo notification center panel

* Revert editor.config changes

* Fix Tests
vnbaaij added a commit that referenced this issue Feb 6, 2024
* Fix #1450

* Fix #1448

* Fix demo notification center panel

* Revert editor.config changes

* Fix Tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants