-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Placeholders cannot also act as fallbacks inside of amp-img tags #12817
Comments
What we should fix here:
This will be a change in behaviour, so we should be mindful of situations this may have negative effects. Possibly keep it under an experiment flag, slowing ramping it up to 100%. /cc @ericlindley-g |
If I understand correctly, if we make this change, there is one case that gets easier, and one case that harder: a) Developer wants placeholder and fallback to be the same (would be much easier) It's hard to know without doing a proper look at a large number of sites, but I expect (b) to actually be more common than (a) If my understanding is correct, I think we shouldn't make this change, and should instead provide an explicit way to use the same content for both fallback and placeholder. WDYT? |
@ericlindley-g (a) is correct, this will make it easier (and consistent with other components) but for (b) this is purely for the case when image fails to load. So (b) is still possible by just providing different |
Got it — thanks for explaining. If placeholder + loading overlay show up anyway, then the proposal before my comment SGTM! |
This issue hasn't been updated in awhile. @cathyxz Do you have any updates? |
Probably won't get to this anytime soon, but I think |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions. |
What was the status of this issue? I know it's been 3 years so a very long time. Would be very useful if this feature was included to help solve bbc/simorgh#8811. |
What's the issue?
amp-img
tags with placeholders but no fallback remove the placeholder on failed load. The documentation seems to indicate that the placeholder should be used as a fallback if none exists. (Though I'm unsure if externally loaded images constitute "dynamic content" in this context.)There appears to be no way to get this behavior without duplicating the nested elements.
How do we reproduce the issue?
See jsbin here. Note how the placeholder texts flash in while the image request is in flight. When the image request fails, the placeholder is removed. Fallback text is then visible only if that element is not also the placeholder.
If necessary, artificially slowing the network via debugging tools can make this more apparent.
What browsers are affected?
Latest Chrome (desktop and Android), Firefox (desktop), IE 11, and Edge
Which AMP version is affected?
1515614886756
The text was updated successfully, but these errors were encountered: