fix(gatsby-image): When art-directing images, default the padding aspect ratio to first image without a media query when no media query matches#21431
Conversation
|
This would be really useful - is this going to merge anytime soon? |
|
Holy buckets, @mjmaurer — we just merged your PR to Gatsby! 💪💜 Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
If there’s anything we can do to help, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’. Thanks again! |
|
I am using gatsby-image 2.3.4 and unfortunately this does not work for me. When the page is loaded it is still using the aspect ratio of the first source instead of the matched one. I am logging out the Here is a preview link: https://preview.zuckerjagdwurst.com |
|
Aso having this issue, but only on production builds, on development it works as expected |
|
@bogdansoare yea, it's only happening in production! |
|
I have the same issue |
|
For now the easiest way to fix this is to have 2 gatsby images one for small screens and one for larger, then toggle between the 2 of them with media queries |
|
Please sub to this issue to be notified of a fix, continue discussion there. |
…ect ratio to first image without a media query when no media query matches (gatsbyjs#21431) * Default to image without a media query when no media queries match window. * update snapshots and change aspect ratio so padding is rational
Description
When art directing multiple images and no media query matches, the current implementation chooses the first image with a media query.
This PR will choose the first image without
mediaif no images match currentwindow. This reflects what one would expect from the documentation (right now the mobile image would never be selected)The documentation reflects what one would expect from mobile-first design.
I don't believe this is a breaking change. Any client that has
mediawith every image will continue to work the same way. Any client that has an image withoutmediaprobably expects the behavior that this PR implements.Related Issues
Addresses documentation error mentioned above
Addresses #15189 when adding a "default" image (without media query)
Related to art direction support in #13395