-
Notifications
You must be signed in to change notification settings - Fork 446
Description
π Bug Report: FluentNavMenu / FluentNavGroup Expanded and Child Navigation Behavior in Blazor Web App
Component
Microsoft.FluentUI.AspNetCore.Components
β Expected Behavior
When using FluentNavMenu with FluentNavGroup:
- If
EnableChildNavigation="true"
(orCollapsedChildNavigation="true"
), child nav items should appear in a popup when the nav menu is collapsed. - If
EnableChildNavigation="false"
, clicking a group should automatically expand the whole nav menu and display the groupβs child links when collapsed. @bind-Expanded
should reliably reflect the current state (expanded/collapsed) of the nav menu.- The
ExpandedChanged
event should fire whenever the nav menu state changes. - Behavior should be consistent between Blazor Server App and Blazor Web App.
β Actual Behavior
-
With
EnableChildNavigation="true"
and@bind-Expanded="false"
initially:- The nav menu is stuck in collapsed state.
- Clicking nav groups only shows the popup once; the menu cannot expand again.
-
With
EnableChildNavigation="true"
and@bind-Expanded="true"
initially:- The nav menu can toggle between expanded β collapsed.
- But child nav popup behavior is broken β child items do not reliably appear.
-
@bind-Expanded
does not update correctly to reflect the real expanded/collapsed state. -
The
ExpandedChanged
event does not trigger when the nav menu state changes. -
Same markup works fine in Blazor Server App, but fails in Blazor Web App (server interactivity).
π¦ Context
-
This issue arises while using FluentNavMenu and FluentNavGroup components from
Microsoft.FluentUI.AspNetCore.Components
inside a .NET 8 Blazor Web App with
InteractiveServerRenderMode
. -
The same markup behaves correctly in the legacy Blazor Server App,
but fails in the new Blazor Web App template. -
The problem specifically impacts child navigation popups from group menu when
EnableChildNavigation
enabled and collapsed/expanded behavior
when binding with@bind-Expanded
or handlingExpandedChanged
.
Environment
- Framework: .NET 8 Blazor Web App
- Render mode:
InteractiveServerRenderMode
- Works correctly in: Blazor Server App (legacy template)
- Fails in: Blazor Web App (new template)
- OS: Windows PC
π Repro Steps
- Create a Blazor Web App with
InteractiveServerRenderMode
. - Add a
FluentNavMenu
with aFluentNavGroup
(see code sample). - Run the app.
- Change
Expanded
totrue
and observe the menu state. - Collapse the menu, then click on the NavGroup header to try expanding it.
- Check whether:
@bind-Expanded
reflects the actual expanded/collapsed state.OnExpandChanged
triggers when the group is toggled.onclick
works in theFluentNavGroup
.
- Compare behavior with a Blazor Server app, where child navigation expands/collapses correctly.
##Observe:
-
@bind-Expanded does not match actual menu state & OnExpandChanged is never triggered in fluent nav menu.
-
onclick is also not triggered in fluent nav group
-
Popup/child navigation behavior differs from Blazor Server.
<FluentNavMenu @bind-Expanded="@Expanded"
CollapsedChildNavigation="@EnableCollapsedChildNavigation"
Width="250"
Collapsible="false"
Title="Collapsible demo"
Style="font-size:14px;color:var(--accent-base-color) !important;
height:90vh;border-right: 1px solid rgba(0, 0, 0, 0.1); ">
<FluentNavLink Icon="@(new Icons.Regular.Size24.Home())" Tooltip="Home" href="/item1">Item1</FluentNavLink>
<FluentNavLink Icon="@(new Icons.Regular.Size24.DesktopMac())" Tooltip="Item2" href="/item2">Item2</FluentNavLink>
<FluentNavLink Icon="@(new Icons.Regular.Size24.CalendarPlay())" Tooltip="Item3" href="/item3">Item3</FluentNavLink>
<FluentNavGroup Icon="@(new Icons.Regular.Size24.Window())" Title="Item4" Tooltip="Item4">
<FluentNavLink Icon="@(new Icons.Regular.Size24.WindowAd())" Tooltip="Item4.1" href="/item4.1">Item4.1</FluentNavLink>
<FluentNavLink Icon="@(new Icons.Regular.Size24.DesktopToolbox())" Tooltip="Item4.2" href="/item4.2">Item4.2</FluentNavLink>
</FluentNavGroup>
</FluentNavMenu>
@code {
private bool Expanded { get; set; } = false;
private bool EnableCollapsedChildNavigation { get; set; } = true;
}