Skip to content

Fix image sizes attribute for constrained layout - #443

Open
erinxocon wants to merge 1 commit into
masterfrom
fix/image-sizes-attribute
Open

erinxocon wants to merge 1 commit into
masterfrom
fix/image-sizes-attribute

Conversation

@erinxocon

Copy link
Copy Markdown
Member

Astro assumes images can fill the viewport, but Starlight caps the content column at 47rem, so browsers picked oversized srcset candidates. Set sizes to the real max display width.

Astro assumes images can fill the viewport, but Starlight caps the content column at 47rem, so browsers picked oversized srcset candidates. Set sizes to the real max display width.
@jacobgkau
jacobgkau force-pushed the fix/image-sizes-attribute branch from 1d96330 to 3e0b698 Compare November 5, 2026 19:38
@jacobgkau
jacobgkau requested a review from a team November 5, 2026 19:45
@jacobgkau jacobgkau self-assigned this Nov 5, 2026

@jacobgkau jacobgkau left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is (obviously) lowering the quality of images displayed on the page. Since we're capping the resolution at the displayed size, the PR description makes it sound like we're simply capping the quality level at what it should be at the displayed size, but the quality difference is perceptible at 100% for some images. Additionally, the quality difference becomes more apparent as soon as you start zooming into the webpage.

Image Image Image Image

So, a couple of questions:

  • Could we calculate twice the size of the max width instead of only the max width? This would provide wiggle room for zooming in (which is very casual to do these days with pinch-to-zoom, and is also an accessibility consideration). It would still be a decrease in size from the current miscalculation, so it would still be a bandwidth reduction for us.
  • If you're not on-board with that approach, what is the AVIF quality level (% or CRF) these resized images are being rendered at, and do we have any control over it? For reference, I use 60% quality for the full-size AVIF images, but in photo/video rendering, it's common to need to increase the quality level as the resolution is decreased (because as resolution decreases, you have less extraneous detail that you could drop).

This branch has not been deployed

No deployments
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.

2 participants