In my website I have 'cards', each one with many elements (image, text, dates, etc.). It's kind of like a tweet card in twitter:
I want the whole card to be clickable (which should be a link to another page).
At the moment, I have the top level element as an <a>
tag and use aria-label
and aria-describedby
so it's read correctly by a screen reader.
<a
href="/some-url"
aria-label="Honda VFR. Price: $10,000. Kilometers: 10,000. Listed yesterday."
aria-describedby="description-1"
>
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/d/d9/1983_Honda_Interceptor_VF750F.jpg/300px-1983_Honda_Interceptor_VF750F.jpg" alt="Honda VFR picture" height="100" />
<p>Honda VFR</p>
<div>
<p>$10,000</p>
<p>Kms: 10,000</p>
<p>Date listed: yesterday</p>
<p id="description-1">This bike is pretty great and a lot of other details go here</p>
</div>
</a>
I considered doing aria-labelledby="title-id-1 price-id-1 distance-id-1"
but I found it read better by explicitly creating a summary sentence.
I am relying on the fact that the screen reader will ignore everything inside the <a>
tag (if I have an aria-label
). Is this a safe bet?
This all seems a bit strange, but I would like to know if there's any specific reason that I shouldn't do this.
Unfortunately the design dictates that the whole card is clickable, so just making only specific parts links is not an option.
The other option is to use a div, aria roles like this and JavaScript, which feels like a step in the wrong direction.
Any help is much appreciated.
jsbin: https://output.jsbin.com/kusawu
One reasonable answer is "the whole card". And by wrapping the card contents in an a tag, it's quite possible. <li> <a href="/card-design-woes"> <img src="/path/to/image.png" alt=""> <h2>Card design woes</h2> <p>Ten common pitfalls to avoid when designing card components.</p> <small>By Heydon Pickering</small> </a> </li>
Use wrapping paper that fits your theme along with ribbons, greenery and a gift tag. Placing the gift card in a box is a simple way to make it feel a little more special and adds an experience of unwrapping! Get all my favorite creative Gift Wrapping Ideas here. Business card holders are a great gift inside of a gift!
Use sharp scissors to avoid tearing! 2. Wrap the long edges of the gift wrap around the card. Fold in the long edges of the gift wrap around the gift card and toward the middle so that they meet and overlap, and then tape the paper down to secure to the surface.
Simply draw, print or stamp your bag, insert gift card and add a Gift Tag. As simple as it seems, opening a box always feels special. Boxes are also easy to wrap! Win, win! Use a jewelry box (higher quality) or a gift card box. A gift inside of a gift!
Is it accessible to wrap a whole 'card' in an tag?
"Accessibility" is a wild concept.
For instance, if you have low vision and use a screenreader to help you read the text inside your "card". Having the aria-label
may prevent the screenreader from reading the content you can partly read. Which means : you know there's a content, you can quite read it, but your screenreader reads another thing different.
That being said, within your examples, it seems that it improves accessibility : user have access to the same content, but in plain english, which is appreciable.
So I don't see it as a problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With