Terra-core: [Terra-Avatar] - Fall Back Icon(USER VARIANT) not coming up in case of Image load failure.

Created on 11 Feb 2019  路  1Comment  路  Source: cerner/terra-core

Bug Report

Description

I am trying to load Terra-Avatar(2.6.0 version) component with Image, hash value and size props.
In case of image load failure, the fall back icon user variant should come up. Instead a Blank circle is coming up. If we dont use Image and initials as props, then the user variant is coming up. But in case of Image Load Failure, User Variant is not coming as fall back icon.

Steps to Reproduce


  1. Build an Avatar Component.
    image={URL of image}
    hashValue={give hash value}
    size="0.6em"
    />
  2. Make sure URL of image is invalid.
  3. Now when we load that avatar component, User Variant will not be coming up as fall back icon.

Additional Context / Screenshots


image

image

image

Expected Behavior

User Variant should come up incase of image load failure.

Possible Solution

Not Sure

Environment

  • Component Name and Version: terra-avatar and version is 2.6.0
  • Browser Name and Version: Chrome
  • Node/npm Version: Node 8

@ Mentions

terra-avatar bug

Most helpful comment

The icon renders correctly on fallback - the issue is that a color variant is not attached to avatar when an image is specified. The color variant styles control the background-color and box-shadow - the icon appears to be missing because the background-color defaults to white.

The fix is to remove this and always have logic to generate a color variant. This will also need to be done in the Facility variant. I'll issue a PR to address this.

>All comments

The icon renders correctly on fallback - the issue is that a color variant is not attached to avatar when an image is specified. The color variant styles control the background-color and box-shadow - the icon appears to be missing because the background-color defaults to white.

The fix is to remove this and always have logic to generate a color variant. This will also need to be done in the Facility variant. I'll issue a PR to address this.

Was this page helpful?
0 / 5 - 0 ratings