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

Removes default content-visibility styles from image components #5180

Merged
merged 1 commit into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .changeset/chilly-experts-add.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
'@astrojs/image': minor
---

Removes the `content-visibility: auto` styling added by the `<Picture />` and `<Image />` components.

**Why:** The [content-visibility](https://developer.mozilla.org/en-US/docs/Web/CSS/content-visibility) style is rarely needed for an `<img>` and can actually break certain layouts.

**Migration:** Do images in your layout actually depend on `content-visibility`? No problem! You can add these styles where needed in your own component styles.
6 changes: 0 additions & 6 deletions packages/integrations/image/components/Image.astro
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,3 @@ const attrs = await getImage(props);
---

<img {...attrs} {loading} {decoding} />

<style>
img {
content-visibility: auto;
}
</style>
6 changes: 0 additions & 6 deletions packages/integrations/image/components/Picture.astro
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,3 @@ delete image.height;
{sources.map((attrs) => <source {...attrs} {sizes} />)}
<img {...image} {loading} {decoding} {alt} {...attrs} />
</picture>

<style>
img {
content-visibility: auto;
}
</style>