File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
packages/mgt-components/src Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -705,8 +705,15 @@ export class MgtPerson extends MgtTemplatedComponent {
705705 */
706706 protected renderImage ( personDetailsInternal : IDynamicPerson , imageSrc : string ) {
707707 const altText = `${ this . strings . photoFor } ${ personDetailsInternal . displayName } ` ;
708- const hasImage = imageSrc && ! this . _isInvalidImageSrc && this . _avatarType === 'photo' ;
709- const imageTemplate = html `<img alt=${ altText } src=${ imageSrc } @error=${ ( ) => ( this . _isInvalidImageSrc = true ) } />` ;
708+ const hasImage = imageSrc && ! this . _isInvalidImageSrc && this . _avatarType === avatarType . photo ;
709+ const imageOnly = this . avatarType === avatarType . photo && this . view === ViewType . image ;
710+ const titleText =
711+ ( personDetailsInternal ?. displayName || getEmailFromGraphEntity ( personDetailsInternal ) ) ?? undefined ;
712+ const imageTemplate = html `<img
713+ title="${ ifDefined ( imageOnly ? titleText : undefined ) } "
714+ alt=${ altText }
715+ src=${ imageSrc }
716+ @error=${ ( ) => ( this . _isInvalidImageSrc = true ) } />` ;
710717
711718 const initials = personDetailsInternal ? this . getInitials ( personDetailsInternal ) : '' ;
712719 const hasInitials = initials ?. length ;
@@ -719,6 +726,7 @@ export class MgtPerson extends MgtTemplatedComponent {
719726 // this reduces the redundant announcement of the user's name.
720727 const textTemplate = html `
721728 <span
729+ title="${ ifDefined ( this . view === ViewType . image ? titleText : undefined ) } "
722730 role="${ ifDefined ( this . view === ViewType . image ? undefined : 'presentation' ) } "
723731 class="${ textClasses } "
724732 >
Original file line number Diff line number Diff line change @@ -224,9 +224,9 @@ export const getPeople = async (
224224} ;
225225
226226/**
227- * returns a promise that resolves after specified time
227+ * Attempts to extract the email from the IDynamicPerson properties.
228228 *
229- * @param time in milliseconds
229+ * @param { IDynamicperson } entity
230230 */
231231export const getEmailFromGraphEntity = ( entity : IDynamicPerson ) : string => {
232232 const person = entity as Person ;
You can’t perform that action at this time.
0 commit comments