visual-framework / vf-core

A (primarily CSS) framework that targets needs of life science websites and services
https://stable.visual-framework.dev/
Apache License 2.0
22 stars 10 forks source link

Clickable images in the news feeds #1750

Closed kasprzyk-sz closed 2 weeks ago

kasprzyk-sz commented 2 years ago

We've received multiple suggestions from users to make the images in the news feed clickable, especially in the vf-news-container--featured variant.

I remember that this topic was raised at the very beginning of embl.org but I don't know why this hasn't been implemented. Would there be any 'No' for that?

Thanks!

nikiforosk commented 2 years ago

The main reason not to do that from an accessibility perspective is to avoid "redundant link" alerts which are triggered when adjacent links go to the same URL (in that case the link on the image and the title of the article would be the same).

When adjacent links go to the same location this results in additional navigation and repetition for keyboard and screen reader users.

Also images that act as links need alt text (which is actually redundant because most of these images are decorative).

The best practice in that case is for the image and the title of the article to be combined in one link (which is how vf-cards work).

I attach a screenshot from the w3 guidelines with the relevant example highlighted:

w3-link-purpose-Screenshot 2022-01-27 at 15 23 10

And another one with the summary of the guidelines from a similar example on a page evaluated by WAVE:

redundant-link-wave-Screenshot 2022-01-27 at 15 27 27

I hope this is useful, please get in touch if you'd like to discuss this more.

nikiforosk commented 2 years ago

The news summaries in the BBC news are applying this best practice - the image and the text below it are one link: bbc-news-iamge-text-link-Screenshot 2022-01-27 at 15 51 23

khawkins98 commented 2 years ago

Hi there! Writing to second @nikiforosk's take that using the vf-card's technique of making the title link cover the clickable area is the better approach.

There will be some gotchas around how to handle other links in the news items, but again you can look to vf-card for an approach.

https://stable.visual-framework.dev/components/vf-card/

grafik

grafik

nikiforosk commented 2 years ago

@sandykadam to ask Maged to look into this at content hub.

sandykadam commented 2 years ago

@nikiforosk I checked this on my local and doesn't seem to be that easy as it contradicts with VF core principles of implementation. So we should hold this until we have PD and this also requires changes in VF core.

I tried to implement what Ken suggested in previous comment, but code wise it looks mixture of summary & card which I think is not the correct way and also the display looks weird.

Screenshot 2022-11-11 at 12 20 49

In above screenshot if you see first box we are achieving the whole block clickable with mixture of vf-card & vf-summary but at the same time display looks bit different.

This is the code to achieve to make it work:

    <article class="vf-summary vf-summary--news">
      <img src="https://stable.visual-framework.dev/assets/vf-summary/assets/vf-summary--news-has-image.jpg" alt="" class="vf-summary__image" loading="lazy">
      <div class="vf-card__content | vf-stack vf-stack--400">
        <h3 class="vf-card__heading vf-summary__title"><a class="vf-card__link" href="JavaScript:Void(0);">some news heading
        </a></h3>
        <span class="vf-summary__date">4 September 2019</span>
      </div>
    </article>

We might have to introduce new varient in vf-summary and for this we will need proper change in VF core.

nikiforosk commented 1 year ago

I just noticed that the vf-video-teaser shows the desired behaviour, i.e. when I mouse over the image the link underneath it is highlighted:

Image

Adedoyinebi commented 4 months ago

@bhushan-ebi as we discussed during the sprint planning meeting, I have done further investigation as to what the best practice recommendation will be to address the issue of redundant links in the vf-news-container.

Best practice recommendations

<a href="home.html">
  <img src="house.gif" alt="home page icon">
  Go to the home page
</a>
<a href="products.html">
   <img src="icon.gif" alt="">
   Products page
 </a>

Useful reads

Next steps