Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it accessible to wrap a whole 'card' in an <a> tag?

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:

enter image description here

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

like image 915
David Gilbertson Avatar asked Mar 15 '17 22:03

David Gilbertson


People also ask

Is it possible to wrap a card in a tag?

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>

How do you wrap a business card?

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!

How do you wrap a gift card without tearing it?

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.

How do you gift wrap a bag of jewelry?

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!


1 Answers

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.

like image 129
Adam Avatar answered Oct 14 '22 23:10

Adam