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

[BUG] The contents of v-card children are duplicated when an anchor tag is added #499

Open
mostafa7904 opened this issue Mar 27, 2022 · 3 comments

Comments

@mostafa7904
Copy link

All the packages version:

"nuxt": "^2.15.8",
"@nuxtjs/vuetify": "^1.12.3"
"vue": "^2.6.14",
"vuetify": "^2.6.4",
"webpack": "^4.46.0"

The contents of v-card-* is duplicated when the link and href attributes are present on the parent v-card and there is an anchor tag in v-card-*.

To Reproduce
Github repo to reproduce the bug
Just run the project and you will see the bug.

Steps to reproduce the behavior:

  1. Add a v-card element to your page
  2. Add the link and href attributes to the v-card component
  3. Add an anchor tag in the v-card-text or v-card-subtitle or v-card-actions
  4. You should now see double the contents, if not reload the page.

Expected behavior
The contents of v-card-text and v-card-actions should not be duplicated.

Screenshots

Screenshot 2022-03-27 140530

Screenshot 2022-03-27 152152

Additional context
This bug only appears in Nuxt so I thought this would be the repo to report this issue, if you reckon it's Vuetify's issue I will open the same issue in Vuetify's repo.

The anchor tag has to be in one of v-card child components (v-card-text, ...).

If you don't see the duplicate content, refresh the page.

@mostafa7904 mostafa7904 changed the title The contents of v-card children are duplicated when an anchor tag is added [BUG]: The contents of v-card children are duplicated when an anchor tag is added Jun 4, 2022
@mostafa7904 mostafa7904 changed the title [BUG]: The contents of v-card children are duplicated when an anchor tag is added [BUG] The contents of v-card children are duplicated when an anchor tag is added Jun 4, 2022
@bastianhilton
Copy link

bastianhilton commented Apr 10, 2023

Look in your developer console in the browser, its probably related to Hydration issues like mine was. The actual fix for me on Nuxt 3 was to disable ssr in my nuxt.config.js

ssr: false,

@Caceresenzo
Copy link

This is the thing. I need to use SSR.

The HTML Spec does not allow a div to be inside an anchor tag, and will auto-close directly when encountering one.

Then Vue tries to hydrate will see that the DOM is not as it should, give a warning and try to correct itself but without removing the extra nodes.

Maybe using spans instead of divs with display: block would help?

@SihemBouhenniche
Copy link

Actually what I've noticed is that i can not put an anchor inside another anchor, some thing like that : <a> <div> some text </div> <a>Anchor</a> </a>
and if you see at the implementation of v-card you can figure that is an anchor element.
So, yeah to avoid that using span instead of divs with display: block` will help (#499 (comment))

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

No branches or pull requests

4 participants