Skip to content

fix: FluentTreeView selection bug #3 #2911

@markoweb2

Description

@markoweb2

🐛 Bug Report

Just tested the new 4.10.3 build, the supposed fixes for FluentTreeView have made it even worse than before :(

💻 Repro or Code Sample

<FluentTreeView Items="@list" @bind-SelectedItem="this.selectedItem">
    <ItemTemplate>
        @context.Text
    </ItemTemplate>
</FluentTreeView>

@code
{
    private ITreeViewItem? selectedItem;
    private List<TreeViewItem> list = new List<TreeViewItem>() { new TreeViewItem() { Expanded = true, Text = "test 1", Items = new List<TreeViewItem>() { new TreeViewItem() { Text = "sub test 2" } } }, 
        new TreeViewItem() { Text = "test 2" } };
}

🤔 Expected Behavior

The control should work and items should be selectable.

😯 Current Behavior

Nothing is selectable in the FluentTreeView:

Image

🔦 Context

This is a regression from 4.10.2, the above code at least worked and everything was selectable.

The original issues were #2797 and #2798 .
If you remove the <ItemTemplate>, then "test 2" and "sub test 2" become selectable, but not "test 1".

Also, if you just use minimalist code:

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

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

Then you now end up with an endless flicker loop (also worse than before):
Image

🌍 Your Environment

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions