Skip to content

fix(nuxt-picture): allow data-* in imgAttrs#2017

Merged
danielroe merged 1 commit into
nuxt:mainfrom
dreitzner:fix-2013-allow-data-attributes-for-img-attrs
Nov 16, 2025
Merged

fix(nuxt-picture): allow data-* in imgAttrs#2017
danielroe merged 1 commit into
nuxt:mainfrom
dreitzner:fix-2013-allow-data-attributes-for-img-attrs

Conversation

@dreitzner
Copy link
Copy Markdown
Contributor

🔗 Linked issue

resolves #2013

❓ 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 fixes a typescript issue, that would give a typescript error when passing a data-* to NuxtImage imgAttrs prop.

@dreitzner dreitzner requested a review from danielroe as a code owner November 6, 2025 08:44
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Nov 6, 2025

Open in StackBlitz

npm i https://pkg.pr.new/@nuxt/image@2017

commit: b6776ab

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 7.07%. Comparing base (39f83b0) to head (b6776ab).

Additional details and impacted files
@@           Coverage Diff            @@
##            main   #2017      +/-   ##
========================================
- Coverage   7.07%   7.07%   -0.01%     
========================================
  Files         77      77              
  Lines       3590    3591       +1     
  Branches     139     139              
========================================
  Hits         254     254              
- Misses      3288    3289       +1     
  Partials      48      48              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

export interface PictureProps<Provider extends keyof ConfiguredImageProviders> extends BaseImageProps<Provider> {
legacyFormat?: string
imgAttrs?: ImgHTMLAttributes
imgAttrs?: ImgHTMLAttributes & DataAttributes
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think Vue itself might expose the types we need here

we did something similar for NuxtLink recently

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This was the first place I looked, but I couldn't find the correct type.

image

In NuxtLink I see a type used from vue-router, but that would not be applicable I think.

@danielroe danielroe changed the title fix-2013: allow data-* on NuxtPicture imgAttrs 🖼️ fix(nuxt-picture): allow data-* in imgAttrs Nov 16, 2025
@danielroe
Copy link
Copy Markdown
Member

thank you! ❤️

@danielroe danielroe merged commit aba9b7f into nuxt:main Nov 16, 2025
7 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 16, 2025
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

Successfully merging this pull request may close these issues.

data-* does not exist in type ImgHTMLAttributes

3 participants