microsoft / fluentui-blazor

Microsoft Fluent UI Blazor components library. For use with ASP.NET Core Blazor applications
https://www.fluentui-blazor.net
MIT License
3.79k stars 363 forks source link

fix: MenuButton not working at all? #2844

Closed RobDene closed 3 hours ago

RobDene commented 3 hours ago

🐛 Bug Report

Copying the test code from the demo site into a new project, menubuttons don't work ?

<FluentStack Orientation="Orientation.Vertical">
    <span>
        Neutral: <FluentMenuButton @ref=menubutton ButtonAppearance="@Appearance.Neutral" Text="Select an item" Items="@items"></FluentMenuButton>
    </span>
    <span>
        Lightweight: <FluentMenuButton @ref=menubutton ButtonAppearance="@Appearance.Lightweight" Text="Select an item" Items="@items"></FluentMenuButton>
    </span>
    <span>
        Outline: <FluentMenuButton @ref=menubutton ButtonAppearance="@Appearance.Outline" Text="Select an item" Items="@items"></FluentMenuButton>
    </span>
    <span>
        Stealth: <FluentMenuButton @ref=menubutton ButtonAppearance="@Appearance.Stealth" Text="Select an item" Items="@items"></FluentMenuButton>
    </span>
    <span>
        With Icon: <FluentMenuButton @ref=menubutton ButtonAppearance="@Appearance.Stealth" Text="Select an item" IconStart="new Icons.Regular.Size16.Globe()" Items="@items"></FluentMenuButton>
    </span>
</FluentStack>
@code {

    private FluentMenuButton menubutton = new();
    private Dictionary<string, string> items = new Dictionary<string, string>()
    {
        {"1","Item 1"},
        {"2","Item 2"},
        {"3","Item 3"},
        {"4","Item 4"},
    };
}

🤔 Expected Behavior

Should work as per the demo site

vnbaaij commented 3 hours ago

Your page is probably in SSR mode. MenuButton requires interactivity

RobDene commented 3 hours ago

No, it's in interactive

vnbaaij commented 3 hours ago

You have the FluentMenuProvider in place?

RobDene commented 3 hours ago

Ahh, that wasn't on the menubutton page 😬 Perhaps worth adding for amateurs like me !

vnbaaij commented 3 hours ago

MenuButton <--> FluentMenuProvider should have given you a hint 😉

Already added. Will be deployed with next release:

Image