question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Placeholders cannot also act as fallbacks inside of amp-img tags

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
aghassemicommented, Jan 12, 2018

What we should fix here: I think it makes sense for amp-img to follow the same model as amp-list and essentially do:

If the image fails to load:
  If there's a fallback element, display the fallback.
  Otherwise, continue displaying the placeholder.

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

0reactions
HarveyPeacheycommented, Feb 10, 2021

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 https://github.com/bbc/simorgh/issues/8811.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Placeholders & fallbacks - amp.dev
NOTE – The placeholder doesn't have to be an AMP element; any HTML element can act as the placeholder. Fallbacks. You can specify...
Read more >
amp-iframe examples and tricks
There is an exclusion of this rule - amp-iframe element can be positioned higher in case it carrying the placeholder attribute and getting...
Read more >
Google AMP - Quick Guide - Tutorialspoint
Placeholder − This placeholder tag will show content before the video starts. Fallback − This tag will be called when the browser does...
Read more >
The International Space Station: Operating an Outpost ... - NASA
We would be remiss to not mention that the ISS would never have become a reality ... astronauts, also members of our team,...
Read more >
5 Reasons Being Outdoors Makes You Happy - Eureka Tents
Not only does vitamin D deficiency impact our health and happiness, ... A study published in 2004 also showed that women who take ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found