Skip to content

Commit b39a309

Browse files
add the ability to provide alt for card image
Co-Authored-By: Ghislaine Guerin <[email protected]>
1 parent f64b2f3 commit b39a309

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

addon/templates/components/es-card.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<li class="card" ...attributes>
22
{{#if @image}}
3-
<img class="card__image" src={{@image}}>
3+
<img class="card__image" src={{@image}} alt={{if @alt @alt ""}}>
44
{{/if}}
55
<div class="card-content">
66
{{yield}}

docs/components/card.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,16 @@ You can also add an image to the card using the `@image` parameter:
2323
</ul>
2424
```
2525

26+
By default images will be considered decorative and ignored by screen readers, but if you want to provide an alt text for the image you can provide it with the `@alt` parameter:
27+
28+
```html
29+
<ul class="list-unstyled">
30+
<EsCard @image="/ember-logo.png" @alt="Ember Logo">
31+
This is a card
32+
</EsCard>
33+
</ul>
34+
```
35+
2636
By default the card will have the image to the left of the content. If you want to make the card a **vertical** card you can apply the `vertical` attribute;
2737

2838
```html

0 commit comments

Comments
 (0)