Setting height on a <nuxt-picture> will lead to a different result than a <nuxt-img>
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.5k
- Forks
- 331
- Avg merge
- 19h 52m
- Merged PRs (30d)
- 9
Description
Hello, we found a small inconsistency between nuxt-picture and nuxt-image. If you add two images and only set the height, the nuxt image will resize the image the image while the nuxt-picture will crop. You can see a reproduction in this sandcodebox.
In the image below you see
<nuxt-img src="/images/portrait-mountains.jpg" height="200px" />
<nuxt-picture src="/images/portrait-mountains.jpg" height="200px" />
<nuxt-img src="/images/mountains.jpg" height="200px" />
<nuxt-picture src="/images/mountains.jpg" height="200px" />
It seems to be caused due to nuxt-picture adding responsive image sizes by default, this then sets the width defined in the screens and the height set defined on the component as a fixed value. My guess is that this is related to the issue mentioned here https://github.com/nuxt/image/issues/238
the nuxt-img component shows the images like expected
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked CodeSandbox reproduction and compare the nuxt-img and nuxt-picture examples that set only height. Inspect how nuxt-picture's default responsive image sizes interact with the component height, including the related issue #238. Done means both components produce consistent sizing for the portrait and landscape examples without unintended cropping.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nuxt, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100