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

<a> as first element inside component breaks layout #11154

Closed
1 task
gauel opened this issue May 27, 2024 · 1 comment
Closed
1 task

<a> as first element inside component breaks layout #11154

gauel opened this issue May 27, 2024 · 1 comment
Labels
needs triage Issue needs to be triaged

Comments

@gauel
Copy link

gauel commented May 27, 2024

Astro Info

Astro                    v4.9.2
Node                     v20.9.0
System                   Windows (x64)
Package Manager          pnpm
Output                   hybrid
Adapter                  @astrojs/vercel/serverless
Integrations             @astrojs/tailwind
                         @astrojs/react
                         pagefind
                         @astrojs/sitemap

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

Chrome

Describe the Bug

Component that starts with <a> weirdly reduplicates its children, better to see it in action:
Preview demo
Demo repository

Demo screenshot:

Snímek obrazovky 2024-05-27 v 18 36 29

Production screenshot:

Starts with <div>:
Snímek obrazovky 2024-05-27 v 18 39 50

Starts with <a>:
Snímek obrazovky 2024-05-27 v 18 40 47

What's the expected result?

In the link above is both the expected result as well as the current bug

Link to Minimal Reproducible Example

https://stackblitz.com/~/github.com/gauel/astro-anchor-bug

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 May 27, 2024
@gauel gauel changed the title <a> as root element re-duplicates children in component <a> as root element duplicates component children May 27, 2024
@gauel gauel changed the title <a> as root element duplicates component children <a> as first element inside component breaks layout May 27, 2024
@matthewp
Copy link
Contributor

Nesting a button inside of an a is not valid HTML. See here: https://stackoverflow.com/questions/6393827/can-i-nest-a-button-element-inside-an-a-using-html5

@matthewp matthewp closed this as not planned Won't fix, can't repro, duplicate, stale May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants