Skip to content
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

'alt' property for describing image element in a herocard is not working #3371

Closed
madbeher opened this issue Jul 29, 2020 · 12 comments · Fixed by #3541
Closed

'alt' property for describing image element in a herocard is not working #3371

madbeher opened this issue Jul 29, 2020 · 12 comments · Fixed by #3541
Assignees
Labels
area-accessibility Bot Services Required for internal Azure reporting. Do not delete. Do not change color. bug Indicates an unexpected problem or an unintended behavior. community-help-wanted This is a good issue for a contributor to take on and submit a solution customer-replied-to Required for internal reporting. Do not delete. customer-reported Required for internal Azure reporting. Do not delete. Good first bug p1 Painful if we don't fix, won't block releasing
Milestone

Comments

@madbeher
Copy link

We are trying to add descriptive text to an image element in hero card using 'alt' property of 'CardImage' object as mentioned in the below document.

https://docs.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/cards-reference#hero-card

https://docs.microsoft.com/en-us/azure/bot-service/rest-api/bot-framework-rest-connector-api-reference?view=azure-bot-service-4.0#cardimage-object

I have attached screenshot of implemented logic
Herocard_LG_Template.zip
for the same.After implementing as shown in the attach image 'alt' property for image is not working and image is not getting displayed as well.

@v-kydela
Copy link

Thank you for the report, @madbeher. What channel are you using?

@v-kydela v-kydela self-assigned this Jul 29, 2020
@madbeher
Copy link
Author

Hi,
As of now I am doing testing in Bot Emulator in local machine only.

Thanks.....

@v-kydela
Copy link

@madbeher - Hero cards don't have an image property. What happens if you try using images instead?

Also, it would help if you posted your code as code instead of a screenshot

@tdurnford
Copy link
Contributor

@v-kydela Hero cards can have an image. Take a look at the Hero Card documentation.

@madbeher I'm going to transfer this issue to the Web Chat repo since this looks like an issue with Web Chat not adding the altText to images in cards.

AdaptiveCardBuilder

-addImage(url: string, container?: Container, selectAction?: CardAction) {
+addImage(url: string, container?: Container, selectAction?: CardAction, altText?: string) {
    container = container || this.container;

    const image = new Image();

+   image.altText = altText;
    image.url = url;
    image.selectAction = selectAction && addCardAction(selectAction);
    image.size = Size.Stretch;

    container.addItem(image);
}

HeroCardContent - Note, this probably needs to be fixed in all of the card attachments.

const HeroCardContent = ({ actionPerformedClassName, content, disabled }) => {

    ....
    const builder = new AdaptiveCardBuilder(adaptiveCardsPackage, styleOptions, direction);

    if (content) {
-      (content.images || []).forEach(image => builder.addImage(image.url, null, image.tap));
+      (content.images || []).forEach(image => builder.addImage(image.url, null, image.tap, image.altText));
      builder.addCommon(content);

      return builder.card;
    }
  }, [adaptiveCardsPackage, content, direction, styleOptions]);
    ....   
};

Additional Context

AdaptiveCards addImage documentation

@tdurnford tdurnford transferred this issue from microsoft/BotFramework-Composer Jul 30, 2020
@tdurnford tdurnford added Bot Services Required for internal Azure reporting. Do not delete. Do not change color. bug Indicates an unexpected problem or an unintended behavior. customer-replied-to Required for internal reporting. Do not delete. customer-reported Required for internal Azure reporting. Do not delete. Good first bug labels Jul 30, 2020
@v-kydela
Copy link

v-kydela commented Jul 30, 2020

@tdurnford - Sorry I'm not sure what you mean when you say hero cards can have an image. Are you just agreeing with what I said about the cards having an images property, or are you saying they have an image property as well? I'm only seeing an images property. Can you show me where the image property is documented?

image

@tdurnford
Copy link
Contributor

@v-kydela Hero cards have an images property - not an image property. You are correct.

@tdurnford tdurnford added the community-help-wanted This is a good issue for a contributor to take on and submit a solution label Jul 31, 2020
@madbeher
Copy link
Author

We tried using both 'image' and 'images' property and both are working.But 'alt' property is not working for both of them. Below is the documentation link which mentions that herocard has 'image' property.

https://docs.microsoft.com/en-us/composer/how-to-send-cards

herocard properties

Please find the attached screenshot from above documentation link which mentions that herocard has 'image' property.

@madbeher
Copy link
Author

Please find below documentation link specific to hero card.

https://docs.microsoft.com/en-us/composer/how-to-send-cards#herocard

herocardtemplateincomposer

@compulim
Copy link
Contributor

compulim commented Jul 31, 2020

Alt-text are something outside for title, subtitle, and text. And the schema doesn't support it.

We need to bring in the service team to update the schema to provide support on accessibility.

We also have another bug #2675 that need schema update for accessibility support.

@compulim
Copy link
Contributor

Few things:

  1. The Composer doc is wrong, there is no image property, but images array.
    • images array has 3 fields: url, alt, and tap
  2. Although Web Chat receive alt, our AdaptiveCardBuilder.ts/addImage does not use the altText field. This should be fixed in Web Chat.

@zxyanliu
Copy link

FYI. The HeroCard template in the Composer documentation was referenced from the sample.

@tdurnford
Copy link
Contributor

tdurnford commented Jul 31, 2020

I believe LG supports both the image and images properties. The BotFramework only supports the images property which is an array of images.

@compulim compulim added this to the R11 milestone Aug 10, 2020
@compulim compulim self-assigned this Sep 18, 2020
@corinagum corinagum removed the R11 label Sep 30, 2020
@corinagum corinagum assigned corinagum and unassigned compulim Oct 2, 2020
@cwhitten cwhitten added the p1 Painful if we don't fix, won't block releasing label Oct 14, 2020
@cwhitten cwhitten changed the title In Composer, 'alt' property for describing image element in a herocard is not working 'alt' property for describing image element in a herocard is not working Oct 14, 2020
@compulim compulim mentioned this issue Oct 29, 2020
48 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-accessibility Bot Services Required for internal Azure reporting. Do not delete. Do not change color. bug Indicates an unexpected problem or an unintended behavior. community-help-wanted This is a good issue for a contributor to take on and submit a solution customer-replied-to Required for internal reporting. Do not delete. customer-reported Required for internal Azure reporting. Do not delete. Good first bug p1 Painful if we don't fix, won't block releasing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants