Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 BUG: <body> tag gets removed when it is a child of a component #935

Closed
1 task
Temez1 opened this issue Feb 17, 2023 · 3 comments 路 Fixed by #990 路 May be fixed by #939
Closed
1 task

馃悰 BUG: <body> tag gets removed when it is a child of a component #935

Temez1 opened this issue Feb 17, 2023 · 3 comments 路 Fixed by #990 路 May be fixed by #939
Assignees
Labels
- P2: nice to have Not breaking anything but nice to have (priority)

Comments

@Temez1
Copy link

Temez1 commented Feb 17, 2023

What version of astro are you using?

2.0.13

Are you using an SSR adapter? If so, which one?

No

What package manager are you using?

npm

What operating system are you using?

Win 10, WSL 2

Describe the Bug

Using nested layouts, the body is missing tailwind classes.

<Base>
    <body class="bg-black">
        <slot />
    </body>
</Base>

Moving <body class="bg-black"> to base layout fixes the problem.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/github-txalzk?file=src/layouts/Home.astro

Participation

  • I am willing to submit a pull request for this issue.
@matthewp matthewp added - P2: nice to have Not breaking anything but nice to have (priority) - P2: has workaround Bug, but has workaround (priority) and removed - P2: has workaround Bug, but has workaround (priority) labels Feb 17, 2023
@matthewp
Copy link
Contributor

I think in a future version of Astro we're not going to allow the <body> or <head> tags to exist unless they are nested inside of <html>. There have been too many bugs with trying to make these things be regular template elements when we in fact have to treat them differently.

@rishi-raj-jain
Copy link

rishi-raj-jain commented Feb 24, 2023

@matthewp

I do agree, but in cases like this, especially with this kind of reproduction where you don't see multiple body tags, but just one inside the slot template, I think it's a valid shared layout usage, right?

or tags to exist unless they are nested inside of

Then how can one update those apart from prop drilling?

@lilnasy lilnasy transferred this issue from withastro/astro Jan 5, 2024
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Jan 5, 2024
@lilnasy lilnasy changed the title Nested Layouts, Body missing Tailwind Classes 馃悰 BUG: <body> tag gets removed when it is a child of a component Jan 5, 2024
@lilnasy lilnasy removed the needs triage Issue needs to be triaged label Jan 5, 2024
@natemoo-re
Copy link
Member

We were able to confirm that this is a specific bug with the JS printer in our compiler rather than a parsing bug, which is good news! Should be a fairly straightforward fix when we have a chance to get to it. I'm going to put it on my shortlist.

https://live-astro-compiler.vercel.app/?editor-state=WzMxLDEzOSw4LDAsMTcxLDE0MSwxNTIsMTAxLDIsMywxMDEsMTQ0LDc3LDc1LDE5Niw2NCwxMiwxMzQsMjU1LDc0LDE1MywxMTUsMjE3LDE2MiwzOSw4OSwxNzAsMTc2LDQyLDEzOCwyMjQsNjUsMTgyLDIzNSwxOTksMTYxLDE1MSwxMTYsMzgsMTQ5LDY2LDU4LDQxLDIwMSwyMTIsNjksMTk3LDI1NSwxMTAsMTgyLDIxMywxNzgsMjMyLDEwNSw2MiwyMjIsMzksMTExLDIyMiwyMjgsMjExLDI0OSw4MSw0LDk5LDE4NiwyMjYsMTI2LDIzMiw4LDIyOSw5LDY5LDU5LDE0MiwxMTAsMjM3LDc4LDg2LDEwMywxNzEsODMsMTUxLDU5LDIwNywxLDIzNyw4OSw5NCwxMzAsMjI2LDY5LDI5LDE3OSwxNzIsMTA4LDU2LDE4OCwxMDMsMTU4LDY0LDI0NSwxODgsMTE4LDQ1LDExNSwzLDgyLDE4Nyw3Myw1MCw4MSwxMzcsODMsODYsMjA0LDk2LDExMywzMiwyMzcsOTAsMjIsODMsMTc3LDE1MywyMzcsODksMTk0LDE3OSwxOTIsNDgsOTYsMTEyLDIzNSwyMiw3Miw0OSwxMTksMjUzLDIyMCw5NiwwLDgxLDUyLDEwMCw1OCwzMSw4OCwxODcsNTIsMjI5LDcyLDUwLDI2LDE0Nyw0LDE2MiwxODIsNDQsMjUzLDkzLDc2LDQwLDE3LDIzMiwxMTMsMTIzLDExMSw1MywxMzQsMTgzLDE1MCw1OCw2NiwxMTEsMTQsMTEzLDM2LDIwMiw5Myw1Miw4LDE2OCwyNTEsMTkyLDExMiwyNDMsNzEsODksNjAsNDIsMzAsMTk3LDk5LDE1LDE5NSwxOCw5NywxNDUsNTQsMTU0LDEzMiwxMTEsMjAxLDcwLDE2MiwxNDEsMTg4LDIzNCwyMjAsOTgsODEsMTUsNzUsMiwxNTksMjU0LDE1MSwxMDksODEsNzEsNzQsMTQ5LDEwMywxNTUsMTcxLDE3OCw1LDQ0LDE5Niw5MSwxMzUsMjUxLDEwNyw3Niw5Niw4MSwxOTQsMTIsMTUzLDIzMSwxNDMsMTY2LDcyLDIzMiwxOSwxMzQsMjIxLDE3NSwyMDMsMTQsMjYsMTA3LDU2LDIzNywyNTEsNzIsMTczLDk0LDE0MiwyNTQsMTkxLDE5MCwxLDYsMTUxLDE5MiwxOTIsMTc3LDEsMCwwXQ%3D%3D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
- P2: nice to have Not breaking anything but nice to have (priority)
Projects
None yet
5 participants