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

Unable to enable Dark Theme when using Blazor SSR and Htmxor #2399

Closed JasonWeise closed 3 months ago

JasonWeise commented 3 months ago

I am currently looking to transition an internal LOB application to Blazor SSR to Blazor SSR + HTMX via Htmxor (https://github.com/egil/Htmxor)

Based on my initial tests the transion has worked very well so far except for an issue whereby I cannot seem to get dark theme to enable at all.

I am have also tried with just the FluentUI-Blazor template in VS2022 where dark theme works fine, but as soon as I add Htmxor components dark theme just disassapears (seems light them just takes over and seems to work so far)

It goes a bit further to the point where if I have the following code snippet in App.razor to stop the dark mode "flash" the body never has it's hidden-body CSS class removed.

<script src="_content/Microsoft.FluentUI.AspNetCore.Components/js/loading-theme.js" type="text/javascript"></script>
<loading-theme storage-name="theme"></loading-theme>

Does anyone have any idea on how to get FluentUI-Blazor and Htmxor to work nicely together, I love using FluentUI-Blazor and I think Htmxor is awesome (I can then do away with Server side SignalR requirement for SSR) so this would be great to get working.

Thanks in advance as always.

vnbaaij commented 3 months ago

Hi,

I think this belongs more in the discussion part of the repo. As you say, dark theme works fine without htmxor so I assume it is not really an issue in the library per se.

I'm not saying there's is nothing we can do about it but I have no experience with and/of knowledge of htmxor.