-
Notifications
You must be signed in to change notification settings - Fork 461
Labels
triageNew issue. Needs to be looked atNew issue. Needs to be looked at
Description
🐛 Bug Report
When using .WithDefault on a color value Design Token, the related css variable is set with an invalid value [object Object]

💻 Repro or Code Sample
<FluentCard>
Test
</FluentCard>
<FluentDivider />
<FluentButton OnClick="ChangeUsingCsharp">
WithDefault (C#)
</FluentButton>
<FluentButton OnClick="ChangeUsingJs">
WithDefault (JS)
</FluentButton>
@code {
[Inject]
public NeutralStrokeLayerRest NeutralStrokeLayerRest { get; set; } = default!;
[Inject]
public IJSRuntime JSRuntime { get; set; } = default!;
// This produces invalid css variable value
private async Task ChangeUsingCsharp()
{
await NeutralStrokeLayerRest.WithDefault("red".ToSwatch());
}
// This one works correctly
private async Task ChangeUsingJs()
{
var module = await JSRuntime.InvokeAsync<IJSObjectReference>("import", "./_content/Microsoft.FluentUI.AspNetCore.Components/Microsoft.FluentUI.AspNetCore.Components.lib.module.js");
await module.InvokeVoidAsync("neutralStrokeLayerRest.withDefault", "red");
}
}🤔 Expected Behavior
When clicking "WithDefault (C#)" the --neutral-stroke-layer-rest should be set to red:

😯 Current Behavior
--neutral-stroke-layer-rest is set to [object Object]

💁 Possible Solution
I currently don't have a suggestion for the fix.
But as a warkaround it is possible to load the JS module and call the design token .withDefault directly:
var module = await JSRuntime.InvokeAsync<IJSObjectReference>("import", "./_content/Microsoft.FluentUI.AspNetCore.Components/Microsoft.FluentUI.AspNetCore.Components.lib.module.js");
await module.InvokeVoidAsync("neutralStrokeLayerRest.withDefault", "red");🔦 Context
🌍 Your Environment
- OS & Device: Windows on PC
- Browser: Microsoft Edge
- .NET 8.0.x and Fluent UI Blazor 4.7.2
Metadata
Metadata
Assignees
Labels
triageNew issue. Needs to be looked atNew issue. Needs to be looked at