Codesandbox: https://codesandbox.io/p/devbox/4vhgj5
Reproduction:
- Create a sample Card Astro component:
// src/components/Card.astro
---
const { title } = Astro.props;
---
<h1>
{title}
<a href={`#`}> Card link </a>
</h1>
- Render Card Astro component in a <a> element:
// src/pages/index.astro
---
import Card from "../components/Card.astro";
---
<main>
<a href="#">
<button>Do something</button>
<Card
href="https://docs.astro.build/"
title="Documentation"
body="Learn how Astro works and explore the official API docs."
/>
</a>
</main>
- Bug:
- Card component is rendered outside <a> (1) element.
- Inside Card component has a weird <a> (2) element has
astro-source-locpoints to the parent <a> (1) element. The <a> (2) element picks up any props passed to the Card component.
Images are attached below.
- Image 1: Show overview of the reproduction project (What are rendered on the screen).
- Image 2: Element tree illustrate the bug mentioned above.
Thanks for following this bug.