-
-
Notifications
You must be signed in to change notification settings - Fork 122
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: Images on iOS are cropped weird #1840
Conversation
Did you explore |
Ah, yes I drafted the PR earlier to explore better solutions but I didn't deep-dive into decode(), thank you.
I was trying with decoding attribute mainly for that, like MDN stated Safari can choose a decoding method opaquely. edit: this is the same issue of videos not being loaded, seems that Safari needs redrawing on imgproxied images |
Loading the image after successful decoding should potentially fix this issue. We're still in a blind scenario but it's still good practice to do so anyway. Before claiming it as ready for review I'll try reproducing with caching edit: same results outside nextjs dev, images load correctly so I think we can safely try it |
Yep, I've confirmed there are no regressions. Let's give a shot. |
Description
Fixes #1793
My hypothesis is that iOS gives up on decoding and thus loading the image if during asynchronous decoding it runs out of resources, indeed on reload the problem might be resolved (essentially retrying decoding).
If we force synchronous decoding, iOS gives this job more priority by using the main thread, potentially fixing weird artifacts and image misplacement.
Screenshots
Additional Context
In a no-cache dev scenario this problem really doesn't exist because after the page is fully loaded, images start loading one by one.
Another possible fix, if this fails, could be to update CSS after all the images are loaded, much like we already do for videos as this fixes it in prod.
There's also another fix that implies reducing the thumbnail resolution to avoid running out of iOS resources
Previously drafted to explore new solutions
Checklist
Are your changes backwards compatible? Please answer below:
Yes
On a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below:
4, issue doesn't present itself in dev
For frontend changes: Tested on mobile, light and dark mode? Please answer below:
n/a
Did you introduce any new environment variables? If so, call them out explicitly here:
No