Skip to content

fix(Link): proxy download property #3879

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

Merged
merged 3 commits into from
Apr 16, 2025
Merged

fix(Link): proxy download property #3879

merged 3 commits into from
Apr 16, 2025

Conversation

dannote
Copy link
Contributor

@dannote dannote commented Apr 13, 2025

πŸ”— Linked issue

No specific issue linked

❓ 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)
  • ✨ New feature (a non-breaking change that adds functionality)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

This change updates the pickLinkProps utility function to include the download property in the list of props it picks from the input.

Previously, the Link component (and other components using this utility) would not pass the standard HTML download attribute through to the underlying <a> tag. This prevented users from creating links that trigger a file download directly via the component.

By adding download to the propsToInclude array, this attribute is now correctly proxied, allowing users to specify download behavior like <ULink href="/path/to/file.zip" download> or <UButton href="/image.png" download="custom-filename.png">.

πŸ“ Checklist

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

Copy link

pkg-pr-new bot commented Apr 13, 2025

npm i https://pkg.pr.new/@nuxt/ui@3879

commit: a477c20

* If set to a string, it suggests that string as the filename.
* If set to `true` or an empty string, the browser suggests a filename.
*/
download?: string | boolean
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove this prop here as it does not belong to NuxtLink. Also, the pickLinkProps is not used in the Button or Link component directly but when using items to render DropdownMenu, NavigationMenu, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, I hope I got it right

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I meant you can remove it completely 😊 Adding it to the pickLinkProps is enough

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see now. Thank you for review!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to emphasize, the <UButton href="/image.png" download="custom-filename.png"> was already working. This will only allow to use to download property inside DropdownMenu items for example.

@benjamincanac benjamincanac changed the title fix(Link): proxy download fix(Link): proxy download property Apr 15, 2025
@benjamincanac benjamincanac merged commit 47cdc2e into nuxt:v3 Apr 16, 2025
6 checks passed
@benjamincanac benjamincanac added the v3 #1289 label Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v3 #1289
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants