Skip to content

fix(nuxt): preserve explicit rel attribute on internal link#19309

Merged
lihbr merged 1 commit into
nuxt:mainfrom
igayamaguchi:fix/rel-is-removed
Feb 27, 2023
Merged

fix(nuxt): preserve explicit rel attribute on internal link#19309
lihbr merged 1 commit into
nuxt:mainfrom
igayamaguchi:fix/rel-is-removed

Conversation

@igayamaguchi

Copy link
Copy Markdown
Contributor

🔗 Linked issue

fix #19299

❓ Type of change

  • 📖 Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • 👌 Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

Add rel attribute even if internal links is set.

📝 Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@codesandbox

codesandbox Bot commented Feb 27, 2023

Copy link
Copy Markdown

CodeSandbox logoCodeSandbox logo  Open in CodeSandbox Web Editor | VS Code | VS Code Insiders

@lihbr lihbr changed the title fix(nuxt): rel is removed when internal link is set fix(nuxt): preserve explicit rel attribute on internal link Feb 27, 2023
@lihbr lihbr added 3.x 🔨 p3-minor Minor issue, should be fixed labels Feb 27, 2023
Comment thread packages/nuxt/src/app/components/nuxt-link.ts
@lihbr

lihbr commented Feb 27, 2023

Copy link
Copy Markdown
Member

Awesome, thank you so much for your contribution!

@lihbr lihbr merged commit 9e6fa9f into nuxt:main Feb 27, 2023
@danielroe danielroe mentioned this pull request Feb 27, 2023
@ydnar

ydnar commented Feb 28, 2023

Copy link
Copy Markdown

This change breaks (with heaps of warnings) if you use <NuxtLink custom ...> to specify a tag other than <a>.

	<NuxtLink custom v-slot="{ href, navigate }" :to="targetRoute">
		<component :is="tag" :href="href" @click="navigate" role="link" class="domain"
			><slot>{{ displayDomain(domain, status) }}</slot></component>
	</NuxtLink>

@TheAlexLichter

Copy link
Copy Markdown
Member

@ydnar could you kindly raise an issue?

@nathanchase

nathanchase commented Mar 3, 2023

Copy link
Copy Markdown
Contributor

FYI: Something in this PR I believe broke NuxtLink, and am now getting flooded with
[Vue warn]: Extraneous non-props attributes (rel) were passed to component but could not be automatically inherited because component renders fragment or text root nodes. anywhere that uses a custom NuxtLink template.

Example:

<NuxtLink
  v-slot="{ href }"
  :custom="true"
  :to="`/user/${id}`"
>
    <a :href="href">
      <img src="avatar.png">
    </a>
</NuxtLink>

The above doesn't error in 3.2.2, but does in 3.2.3.
Repro: https://stackblitz.com/edit/github-hmvahh?file=app.vue

@TheAlexLichter

Copy link
Copy Markdown
Member

@nathanchase see #19375 and #19379 which resolves that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.x 🔨 p3-minor Minor issue, should be fixed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

nofollow is removed when internal links is set

5 participants