-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reset layouts still inherit their parents' styles #3622
Comments
Reason in #1356 (comment) Is this only when using client side navigation (e.x. by clicking links to go from a page using the root layout to one using the nested layout), or do you still see the unexpected background color after refreshing the page? |
Both, that's why I considered it not being a bug but a feature |
This is a consequence of how styles work in SvelteKit — if you import a component, its CSS will be applied to the page, regardless of whether it is rendered or not (and it won't be removed when the component is destroyed), because the contents of Styles from the root layout will therefore always apply, because the root layout is always imported eagerly (along with the root error component). You'll have to work around it by avoiding global Realistically this would be very difficult to change, so I'm going to close this issue. (Note that layout resets have been replaced by named layouts.) |
This makes sense, thanks for answering |
Describe the bug
__layout.reset.svelte does not reset the style stack
Reproduction
/src/routes/__layout.svelte
/src/routes/nested/__layout(.reset)?.svelte
Without .reset:
With .reset:
(It should not have the blue background)
Logs
No response
System Info
Severity
annoyance
Additional Information
I'm not sure if this is the intended behavior, but it seems inconsistent
The text was updated successfully, but these errors were encountered: