Skip to content

fix: FluentMenuProvider and similar in js module loaded matching algo which leads to Menus, Dropdowns and Switch not applying the set Theme mode and Custom color #4240

@bzashev

Description

@bzashev

🐛 Bug Report

When trying to setup a custom color and theme mode with FluentDesignTheme component I noticed that my settings are not applied in menus, dropdowns of selects and switches. After a long investigation the problem was localized in me using a cache breaker for loading the Microsoft.FluentUI.AspNetCore.Components.lib.module.js. My guess is that this caused the module not to be found by the Menu Provider and initialized again with the default theme and color settings.
The problem disappears after the cache breaker is removed

💻 Repro or Code Sample

Example Github repo

Check the App.razor, you can comment and uncomment where pointed out to simulate the effect.

🤔 Expected Behavior

The set theme mode and customer color to be applied globally

😯 Current Behavior

In the :host scope of the menu shadow dome, the mode and accent colors are inited with their default values, not with the ones set by the FluentDesignTheme component. In the rest of the application the customization is applied correctly

💁 Possible Solution

Check and fix the matching algorythm for discovering whether the *.module.js is loaded or not

🌍 Your Environment

  • .NET 9 and Fluent UI Blazor library Version [4.12.1]

Metadata

Metadata

Assignees

No one assigned

    Labels

    triageNew issue. Needs to be looked at

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions