October 6, 20242 yr Hello everyone. I am using an image as a link and I want to make sure it is accessible. So I found this but in their example they have an onClick() event. My question is. Do I need role="link" if I have this as my code? <a href="#startseite"> <img src="img/startseite.svg" alt="Startseite" title="Startseite" /> </a> Many thanks for your help!
October 7, 20242 yr No. but do you really need an image to link back to the homepage? Accessibility is poor and Google prefers text. Remember that internal linking is a powerful SEO technique if done correctly.
October 7, 20242 yr Author <img src="img/startseite.svg" That is a font I could not find anywhere, so I recreated it as a picture. Is that a bad idea? And it needs no role? Thanks for your help! Edited October 7, 20242 yr by silly.questions
October 7, 20242 yr The font should be the same as the rest of the site. Why make it so complicated. You don't need the role. Just have a styled text button. Keep it simple.
December 23, 2025Dec 23 No, you don’t need role="link" here. Your code is already accessible because you’re using a native <a> element, which has the link role by default. Why this is correct: <a href="..."> is automatically announced as a link by screen readers The alt="Startseite" text provides an accessible name for the link Keyboard navigation (Tab + Enter) works out of the box role="link" is only needed when you’re not using a semantic link, for example: A <div> or <span> acting like a link JavaScript-only click handlers (onClick) without an <a> So your current markup is already the best practice. Just keep the meaningful alt text, and you’re good.
Create an account or sign in to comment