-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Super broad selector for images max-width on WP 5.9.1 breaks image width #39021
Comments
Thanks @wolffe for opening the issue here. Below are some screenshots, using Kwicks Slider: |
This is way too broad. |
Fixed via #39045 and will be backported into the next minor release. |
This might reduce the issues, but not fix them completely. The selector is still there:
It's just the class that has been appended. In my case, I use WordPress native functions to generate the images in the carousel, so it will still be broken for me. |
@wolffe I use |
@wolffe, which functions are you using to get images for the carousel? |
I think I use the same function as @hvianna. I'll report back/again after I apply this update. Thanks! |
The implemented fix should only affect images added through the Classic Editor with the "Add Media" option. To my knowledge, no other part of the wp core adds the class The |
For me, the moment it was implemented, it broke 200+ websites. It shouldn't have been added, as this is theme territory. All my images, regardless of how they were added to the post, were working fine before this new code has been added. |
I meant that the new proposed implementation should not affect your images! Sorry for my confusing writing :) |
Had the same issue as @wolffe, broke a lot of our websites built using the classic editor as the selector is far too broad and just applied the styling to every |
Just throwing my hat in the ring as this affected several of our sites. This kind of broad selector should not be Wordpress includes and should be removed. |
They changed the selector (see above) and the fix is coming in WordPress |
It does not appear this was resolved with the 5.9.2 update - I'm still seeing this rule after updating:
/wp-includes/css/dist/block-library/style.min.css?ver=5.9.2 |
They moved it to 5.9.3 or 6.0. @audrasjb can confirm. |
I was surprised by this breaking code as well. Please don't make such broad changes. And if I'm understanding the where() pseudo class correctly, doing html :where(img) isn't even useful, which makes me suspicious of whoever added it. Isn't that the same thing as doing "html img" or just "img", which would then make it really obvious that they were changing every single image on the entire site? Adding in the class selector would fix it for me, and I'll edit the core code so my site won't be broken until the next upgrade at least. But, I agree that it seems reasonable to me that even with the class would break on some sites. |
The fix will be part of 5.9.3 release. |
I just had about 10,000+ users of an old theme (circa 2012) of mine get hit with this as well. Very full inbox for me for a very old, unrelated, intentionally opted-out-of-Block-Editor product. |
Version 5.9.3 works for me! 👍 |
Thanks for the confirmation, @hvianna. I'm going to close the issue. |
Sooooo I'm seeing this exact issue on a site running 6.0.2... was this actually fix or has the problem been reintroduced? This is the code I'm seeing: html :where(img[class*=wp-image-]) { I've joined Github specifically to try and figure out what's happening here as this is doing my head in! |
The issue was never fixed, they just made the selector less broad. Before, it used to be |
Yeah I still can't get my head round this. The images that are being affected at my end are being added through a module in the Elegant Themes Divi theme. So they're not being added using Gutenberg/standard WP processes. Is there a way to nullify it using CSS? |
The way I solved it is above. On 2 custom themes, I had to add this:
Also, I have other overrides for specific blocks, so it now works for me. |
thank you - I'll give that a crack |
Description
This was reported on Trac.
Copy-pasting from https://core.trac.wordpress.org/ticket/55229
Props hvianna for the original report.
I recently updated to WP 5.9 and noticed some undesired behavior on images in my custom theme, caused by the CSS declaration below (from
./wp-includes/css/dist/block-library/style.min.css
):This causes images that would previously overflow a smaller container to be "squished" inside it now. Any reason to use such a broad selector on core?
My comment:
This also broke Metafizzy's Flickity slider for me and squishing off-canvas images. It's a breaking change that will affect various image containers, such as sliders, carousels, image animations and so on.
I had to override the CSS selector with:
This new selector broke images on 200+ websites we currently manage.
Step-by-step reproduction instructions
Screenshots, screen recording, code snippet
No response
Environment info
WordPress 5.9.1 with and without Gutenberg (latest version).
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: