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

Parse padding presets for use in sizes values #1240

Open
Tracked by #760
joemcgill opened this issue May 23, 2024 · 2 comments
Open
Tracked by #760

Parse padding presets for use in sizes values #1240

joemcgill opened this issue May 23, 2024 · 2 comments
Labels
[Plugin] Auto Sizes Issues for the Auto Sizes plugin

Comments

@joemcgill
Copy link
Member

joemcgill commented May 23, 2024

As described in this comment. In order to make an image's sizes value more accurately reflect the constraints of its alignment container, we need to incorporate the way padding settings affect the width of the container. For example, in the Twenty Twenty-four theme, the default settings.layout.contentSize setting is 620px, which is the max size that the container will be on larger viewport widths, but that width gets constrained by the padding styles for the site.

image

However, in many cases, theme.json padding styles reference the global padding settings, using CSS variables like var(--wp--preset--spacing--50), which cannot be calculated by the browser when the sizes attribute is parsed, so we will need a way to parse these settings into valid media query values.

@joemcgill joemcgill added [Focus] Images [Plugin] Auto Sizes Issues for the Auto Sizes plugin labels May 23, 2024
@joemcgill joemcgill changed the title Parse padding presets for use in sizes values Parse padding presets for use in sizes values May 23, 2024
@swissspidy
Copy link
Member

An alternative to parsing those values could be to use Optimization Detective, WDYT?

@joemcgill
Copy link
Member Author

For sure! But I intentionally don't want to make OD a dependency of this effort for now. I think OD could be used to enhance things but it would be good to have some improvements that could be merged to WP without also merging the whole OD API.

@sstopfer sstopfer added [Focus] Images [Plugin] Auto Sizes Issues for the Auto Sizes plugin and removed [Focus] Images [Plugin] Auto Sizes Issues for the Auto Sizes plugin labels May 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Plugin] Auto Sizes Issues for the Auto Sizes plugin
Projects
Status: Not Started/Backlog 📆
Development

No branches or pull requests

3 participants