prismicio / prismic-next

Helpers to integrate Prismic into Next.js apps
https://prismic.io/docs/technologies/nextjs
Apache License 2.0
57 stars 7 forks source link

Height attribute in PrismicNextImage is not always an integer #96

Open john-mantas opened 2 months ago

john-mantas commented 2 months ago

When using <PrismicNextImage /> with the width prop defined but without specifying a height, the resolved height may result in a floating-point value, which doesn't follow the html spec and triggers errors when you run it throught https://validator.w3.org/nu/.

height

Versions

Reproduction

Upload an image with 128x37 px size in Prismic and use it with <PrismicNextImage field={image} width={110} />.

Steps to reproduce

Check the img element in dev tools or validate the page to https://validator.w3.org/nu/.

What is expected?

Resolved height should always be a non-negative integer.

What is actually happening?

The height isn't always an integer, depending on the width/ar it can be a floating-point number.

github-actions[bot] commented 2 months ago

This issue has been labeled as a bug since it was created using the 🚨 Bug Report Template.

Hi there, thank you so much for the report!

Following our Maintenance Process, we will review your bug report and get back to you next Wednesday. To ensure a smooth review of your issue and avoid unnecessary delays, please make sure your issue includes the following:

If you have identified the cause of the bug described in your report and know how to fix it, you're more than welcome to open a pull request address it. Check out our quick start guide for a simple contribution process.

If you think your issue is a question (not a bug) and would like quicker support, please close this issue and forward it to an appropriate section on our community forum: https://community.prismic.io

- The Prismic Open-Source Team