microsoft / microsoft/fluentui-blazor
fix: Selection Bugs after filtering Items in FluentListbox
@dvoituron is already working on this.
Since Sep 7, 2026.
- Dominant language
- C#
- Stars
- 4.8k
- Forks
- 483
- Avg merge
- 14h 41m
- Merged PRs (30d)
- 68
Description
🐛 Bug Report
When a selection in FluentListbox is made and the selected item get removed(e.g. filtered out), the selection marker gets applied to a wrong item. Additionally, that wrongly selected item cannot be really selected anymore except selecting an other item first.
💻 Repro or Code Sample
<FluentListbox TOption="int"
TValue="int"
Multiple="false"
Items="FilteredValues"
ValueChanged="SelectionChanged" />
<FluentButton OnClick="ApplyFilter">Apply Filter</FluentButton>
@code {
private ImmutableList<int> AllValues = new List<int>()
{
1,2,3,4,5,6,7,8,9
}.ToImmutableList();
private IEnumerable<int> FilteredValues = null!;
protected override void OnInitialized()
{
base.OnInitialized();
Console.WriteLine("DEBUG: Init done.");
FilteredValues = AllValues;
}
private void SelectionChanged(int number)
{
Console.WriteLine(number);
}
private void ApplyFilter()
{
FilteredValues = AllValues.Where(i => i != 4 && i != 6);
}
}
🤔 Expected Behavior & 💁 Possible Solution
Behaviour like in V4: If an item that is selected is filtered out, don't internally mark an other item as selected.
😯 Current Behavior
Selecting Number 4 -> Okay:
After using the button to apply the filter, 4 and 6 are removed. The selection marker jumps to 5, however the changed selection isn't reflected by calling the EventCallback ValueChanged. Additionally the 5 isn't selectable (as the Listbox thinks, it is selected) and is only selectable, when first an other number gets selected (if in my real code there is only one item left, I get stuck with an unselectable item).
🔦 Context
I'm using the Listbox to display several items by name. Filter gets applied programmatically after using a button or a checkbox to filter out several items (e.g. depending on their property 'status'). In some cases, I only have one item left. If there was a selection previously I get stuck with an unselectable item.
🌍 Your Environment
- OS & Device: Windows Server 2025 running Blazor Server; Windows 11 as Client
- Browser: Brave, Firefox, Edge (but most likely all affected)
- .NET 10 and Fluent UI Blazor library 5.0.0-rc.5-26219.1
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.