Skip to content

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

@arazni

Description

@arazni

🐛 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions