Skip to content
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

[gatsby-remark-images] Remove negative z-index for .gatsby-resp-image-wrapper #1947

Merged

Conversation

fk
Copy link
Contributor

@fk fk commented Aug 28, 2017

Fixes #1935 plus the missing half of #1888.

Currently gatsby-remark-images adds an inline style containing z-index: -1 for gatsby-resp-image-wrapper. Our (now also optional) wrapper for the latter, gatsby-resp-image-link, does not provide a stacking context of its own. This results in .gatsby-resp-image-wrapper being "stacked" relative to the parent element that provides this context.

In the case where one of the parent elements of .gatsby-resp-image-wrapper defines a background (color or image), and the stacking context will be provided by another parent of that element with the background, .gatsby-resp-image-wrapper will be covered by that background of that parent in between itself and the parent providing context. This is very likely to happen (as reported in #1888 and #1935).

gatsbyjs.org is not currently affected by this simply because we do not define any background color for one of the parent elements that .gatsby-resp-image-wrapper are rendered in. If we apply one for e. g. .main-body, all content added by gatsby-remark-images will be covered.

Furthermore, I can't find a reason why we should need z-index here – .gatsby-resp-image-image should always display "above" the base64-encoded, blurred background-image defined inline for .gatsby-resp-image-background-image.

@KyleAMathews
Copy link
Contributor

Seems legit! Thanks!

@KyleAMathews
Copy link
Contributor

Appreciate the thorough research/explanation as always!

@KyleAMathews KyleAMathews merged commit 52fdafb into gatsbyjs:master Aug 28, 2017
@KyleAMathews
Copy link
Contributor

Deploy preview failed.

Built with commit 1c3583b

https://app.netlify.com/sites/using-glamor/deploys/59a47e357960b13763d3fb81

@gatsbybot
Copy link
Collaborator

Deploy preview ready!

Built with commit 1c3583b

https://deploy-preview-1947--gatsbygram.netlify.com

@fk fk deleted the gatsby-remark-images-remove-negative-zindex branch August 28, 2017 22:46
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.

None yet

3 participants