Skip to content

fix: FluentTreeView selection bug #2797

@markoweb2

Description

@markoweb2

🐛 Bug Report

When using data binding, first click to select an item works.
Second click, to select another item, flashes the blue selection marker briefly, then clears the selection. (first item stays selected)
Third click works and selection moves to another item. Then the bug repeats.

💻 Repro or Code Sample

Create new Blazor Web App in Visual Studio.
Set render mode to @rendermode="new InteractiveServerRenderMode(false)"
Install FluentUI nuget package and perform the setup steps.
Use this code on home page to introduce the bug:

<PageTitle>Home</PageTitle>

<FluentTreeView Items="@list">
</FluentTreeView>

@code
{
    private List<TreeViewItem> list = new List<TreeViewItem>() { new TreeViewItem() { Text = "test 1" }, new TreeViewItem() { Text = "test 2" }, new TreeViewItem() { Text = "test 3" } };
}

Entire repo also attached:
BlazorApp1.zip

🤔 Expected Behavior

The second click should change the selection normally.

😯 Current Behavior

Image

💁 Possible Solution

Not sure if this is anyway related to using the default bootstrap template. Perhaps some css or javascript interferes. (if so, needs to be made to work with this default Visual Studio template)
Could also be a flat out bug in FluentTreeView.

🔦 Context

Show stopper issue, can't continue with my project. And I haven't even gotten further than just the home page (where I need the TreeView).

🌍 Your Environment

  • OS = Windows
  • Browser = Microsoft Edge, Google Chrome
  • .NET and Fluent UI Blazor library Version = 8.0.10 and 4.10.2
    Visual Studio 2022 (17.11.5)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions