Replies: 4 comments 5 replies
-
I think we're going to need more info. How are you including the stylesheet? Are you loading Shoelace as a |
Beta Was this translation helpful? Give feedback.
-
Is it possible that the navigation is updated via AJAX and there's some morphing happening? If yes, the server isn't aware of any hydrated or dynamic attributes and depending on the morphing strategy you'll lose them. I experienced this problem with Laravel Livewire and wrote down how I solved it in the end: https://mariohamann.com/livewire-web-components-attributes In your particular case: What happens if you explicitly set the |
Beta Was this translation helpful? Give feedback.
-
This is indeed caused by .NET 8's enhanced navigation feature. The issue is not specific to Shoelace, it would affect any UI library that alters classes or attributes dynamically. In this case, Shoelace is adding some attributes with default values to certain elements when no explicit value is specified (for example, variant and size are automatically added to sl-button). It appears these attributes are necessary for the element to render correctly. Unfortunately Blazor's enhanced navigation feature wipes out these attributes when navigating between pages because they were added dynamically, and it is not aware of them. I've found that it's possible to work around the problem by specifying explicit values for these attributes instead of allowing Shoelace to assign defaults itself, but since that's pretty cumbersome... I've written a small script that works around the problem using a MutationObserver: it simply restores the old value of the
|
Beta Was this translation helpful? Give feedback.
-
I don't know if it'll happen in Shoelace 2.0, but I have a pretty good idea how to fix this in Web Awesome with attribute converters. |
Beta Was this translation helpful? Give feedback.
-
When I click on a link, the Shoelace themes are not applied, but upon clicking refresh, the themes are applied. Below is a before and after image:
Details:
This is a blazor .net 8 static driven application. Shoelace is being used to render the static components along with htmx. I am new to shoelace and the shadow dom technique. Are there any ideas on why a navigation from within the app would prevent the theme from appearing?
thanks
Rob
Beta Was this translation helpful? Give feedback.
All reactions