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.

bug: ion-img: alt text shown for brief period before src is set on inner img

See original GitHub issue

Feature Request

Ionic version:

[x] 5.x

Describe the Feature Request

Currently, the alt attribute of ion-img will be displayed when the image is loading. But I think the alt attribute of ion-img should only be displayed when the image fails to load, just like the native img tag.

Describe Preferred Solution

Describe Alternatives

When loading an image, ion-img should show the loading state(spinner) instead of displaying the content of the alt attribute

Related Code

Additional Context

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:1
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
matEhickeycommented, Feb 19, 2021

+1 problem is still here

0reactions
tnoetzelcommented, Aug 16, 2021

Here’s a workaround until this gets fixed:

CSS:

ion-img::part(image) {
    display: none;
}

ion-img.show::part(image) {
    display: block;
}

React TSX:

<IonImg onIonImgDidLoad={(e: any) => e.target.classList.add('show')} src={'yourimage.png'} alt="whatever" />
Read more comments on GitHub >

github_iconTop Results From Across the Web

bug: ion-img can sometimes not load in on a lower-end CPU ...
If the ion-img has been supplied a src, and has been scrolled into ... bug: ion-img: alt text shown for brief period before...
Read more >
why img alt not working in ionic? - Stack Overflow
I have set the alt tag inside img tag, but this is not working. I want to implement that it can show a...
Read more >
images flash alt attribute while being fetched - Bugzilla@Mozilla
Bug 1472637 - Don't display alt text while loading, to match other UAs. ... small period of time when both the broken state...
Read more >
ion-item - Ionic Framework
ion-item elements for iOS/Android contain text, icons, images, and other custom elements. They're placed in a list and can be input, deleted, edited,...
Read more >
Image Missing Alternative Text - Equalize Digital
Did “Image Missing or Empty Alternative Text” appear in an accessibility audit of your website? Review the explanation of this error.
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