Closed T1xx1 closed 2 months ago
I've set the <a>
border red in the stackbliz preview so it's clearer
You cannot have a
tags inside other a
tags in HTML. The same problem happen in normal HTML, outside of Astro.
Transparent, but there must be no interactive content descendant, a element descendant, or descendant with the tabindex attribute specified.
For instance, this code in a .html file:
<a href="a-link">
<h3>Title</h3>
<div>
<div>
<div>Hello</div>
<a href="some-other-link">Another link</a>
</div>
</div>
</a>
result in this HTML in the browser (ignore the formatting, just ran it through Prettier so it's easier to read), with duplicated links everywhere:
<a href="a-link">
<h3>Title</h3>
</a>
<div>
<a href="a-link"></a>
<div>
<a href="a-link">
<div>Hello</div>
</a>
<a href="some-other-link">Another link</a>
</div>
</div>
Astro Info
If this issue only occurs in one browser, which browser is a problem?
No response
Describe the Bug
I'm loading a list of dynamic component previews with
import()
and showing them with amap()
inside a<a>
tag that redirects to the component page.One component wasn't loading correctly outside of the
<a>
borders.I looked into the HTML with dev tools and I find out that something strange is happening.
The
<Component />
is not loading inside the<a>
tag and the same<a>
is being loaded inside the component's subtags recursively.Look for
<a href="./createaccount">...
What's the expected result?
Load correctly.
Workaround: use something else than
<a>
The bug only happens when the parent is a
<a>
.Codebase Commit before I "fixed" this.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/withastro-astro-txw7ef?file=src%2Fpages%2Findex.astro&view=editor
Participation