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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

html tag attributes getting replaced in layout file - contrary to what docs say #12846

Open
1 task
dreamstar-enterprises opened this issue Dec 28, 2024 · 3 comments
Labels
needs repro Issue needs a reproduction

Comments

@dreamstar-enterprises
Copy link

Astro Info

5.1.1.

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

<html lang="en" dir="rtl" class="h-full w-full">
<head>
  <Head />
  <title></title>
</head>
<body class="m-0 h-full w-full">
<main class="flex min-h-screen flex-col">
  <Header />
  <slot />
  <Footer />
</main>
</body>
</html>

I am losing the dir=ltr, in the output, using npm run dev

Browser output is:

<!DOCTYPE html>
<!-- Character encoding and viewport settings -->
<html><head>

This is not what the docs say:
https://docs.astro.build/en/basics/layouts/

What's the expected result?

Should obey behaviour stated in docs, and not lose html attributes that are set, if working in a layout

Link to Minimal Reproducible Example

https://seeexampleabove

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Dec 28, 2024
@florian-lefebvre florian-lefebvre added the needs repro Issue needs a reproduction label Jan 1, 2025
Copy link
Contributor

github-actions bot commented Jan 1, 2025

Hello @dreamstar-enterprises. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with needs repro will be closed if they have no activity within 3 days.

@github-actions github-actions bot removed the needs triage Issue needs to be triaged label Jan 1, 2025
@dreamstar-enterprises
Copy link
Author

dreamstar-enterprises commented Jan 1, 2025

Here is min repo code:

BaseLayout.astro

<!doctype html>
<html lang="en" class="h-full w-full" transition:name="root" transition:animate="none">
<head>
  <Head />
  <title></title>
</head>
<body dir="ltr" class="m-0 h-full w-full">
<main class="flex min-h-screen flex-col">
  <Header/>
  <slot />
  <Footer/>
</main>
</body>
</html>

index.astro

<BaseLayout>
<HomeSection/>
</BaseLayout>

Let me know if you need naything else.

I had to keep dir="ltr" in the body as the html tag was not being preserved

@ascorbic
Copy link
Contributor

ascorbic commented Jan 3, 2025

I can't reproduce the problem. I created a layout like this and it was preserved in the output. Please provide a reproduction on Stackblitz.

<!doctype html>
<html lang="en" dir="rtl" class="h-full w-full">
  <head>
    <title></title>
  </head>
  <body class="m-0 h-full w-full">
    <main class="flex min-h-screen flex-col">
      <slot />
    </main>
  </body>
</html>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs repro Issue needs a reproduction
Projects
None yet
Development

No branches or pull requests

3 participants