-
Notifications
You must be signed in to change notification settings - Fork 65
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
fix: figcaption rendering bug in Safari #1382
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a version of this fix that's only applied to mobile in the _blocks.scss file though this location makes more sense! That one should probably be removed, too as part of this PR.
The theme did include this fix for screen sizes at one point, but it causes smaller floated images to have their captions run wider than the images themselves. There's some more information and screenshots for that here:
IIRC the too-small-images-and-wide-captions issue was only reported once while this fix was in the theme, so I think that might be an acceptable trade-off at this point, since the caption gap issue has come up pretty often. I've been manually adding CSS fixes to the sites that report it, but it's probably better to go the other way around and manually undo it on any sites that report the small-image-wide-caption issue instead (I remember the site that originally reported the issue, so I can take care of that ahead of this being merged).
Let me know what you think about the above! If it sounds okay, I think this will be good to go once the near-duplicate styles are removed from _blocks.scss.
Wow, thanks for the historical context around this bug! That's a pretty infuriating trade-off—either we fix the bug in Safari at the expense of introducing another bug with smaller images in all browsers, or we leave the bug in Safari... As discussed off GitHub, maybe the best hybrid approach is to fix the bug only in Safari and leave core styles active for all other browsers. This will introduce the bug with small-images-with-both-alignment-and-long-captions on desktop viewports in Safari only, but that seems to be more of an edge case than the caption rendering bug for Safari users. This StackOverflow thread discusses some CSS hacks that supposedly work to target CSS in specific versions of Safari. I tried the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @dkoo!
I took this for a spin both locally and using Browserstack; I can confirm this fix works, and, by using a smaller image, confirm that it's only being applied to Safari 9+ (on Safari 8, and other browsers, the smaller image's caption matches its width).
Thanks for tackling this! I'm looking forward to never hearing about this one again, it's been an annoying one 😄
@dkoo I'm on a bit of a merging spree so I'm going to go ahead and merge this one! :) |
Oh, thanks for merging! |
## [1.39.3-alpha.1](v1.39.2...v1.39.3-alpha.1) (2021-07-06) ### Bug Fixes * ads media queries ([239ff6e](239ff6e)) * correct custom fonts in block widget preview ([#1401](#1401)) ([878b6a1](878b6a1)) * figcaption rendering bug in Safari ([#1382](#1382)) ([e274499](e274499)) * improve donate block appearance for WP 5.8 ([#1398](#1398)) ([51fc4f7](51fc4f7)) * prevent white screen and errors on Widget Screen ([#1390](#1390)) ([5731581](5731581))
🎉 This PR is included in version 1.39.3-alpha.1 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
## [1.39.3](v1.39.2...v1.39.3) (2021-07-06) ### Bug Fixes * ads media queries ([239ff6e](239ff6e)) * correct custom fonts in block widget preview ([#1401](#1401)) ([878b6a1](878b6a1)) * figcaption rendering bug in Safari ([#1382](#1382)) ([e274499](e274499)) * improve donate block appearance for WP 5.8 ([#1398](#1398)) ([51fc4f7](51fc4f7)) * prevent white screen and errors on Widget Screen ([#1390](#1390)) ([5731581](5731581))
🎉 This PR is included in version 1.39.3 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
All Submissions:
Changes proposed in this Pull Request:
Fixes an obscure Safari rendering bug which causes captions inside image blocks with an alignment set to render in the wrong position.
Closes #1132
How to test the changes in this Pull Request:
master
, view the post in Safari. Observe that the caption appears in the wrong place (if you don't see the bug, try hard-refreshing the post):Other information: