Skip to content

Fix: aria-labels for static and dynamic links plus aria-labelledby, titles and descriptions for svg images #434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<!-- AUTO-GENERATED-CONTENT:START (STARTER) -->
<p align="center">
<a href="https://www.gatsbyjs.org">
<a alt="Link to page Gatsby JS" href="https://www.gatsbyjs.org">
<img alt="Gatsby" src="https://www.gatsbyjs.org/monogram.svg" width="60" />
</a>
</p>
Expand Down
4 changes: 3 additions & 1 deletion src/assets/images/about.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion src/assets/images/contact.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion src/assets/images/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion src/assets/images/mission.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/components/Button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const Button = React.memo(({ children, className, to, onClick }) => {
if (to) {
if (to.startsWith('http')) {
return (
<a href={to} className={css}>{children}</a>
<a aria-label={children} href={to} className={css}>{children}</a>
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/MainNav/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const MenuLink = React.memo(({ children, to }) => {
if (to && to.startsWith('http')) {
return (
<li className={liCss}>
<a href={to} className={linkCss}>{children}</a>
<a aria-label={children} href={to} className={linkCss}>{children}</a>
</li>
);
}
Expand Down
10 changes: 5 additions & 5 deletions src/components/Sidebar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ function FeaturedMentor({ mentor, isAuthor }) {
<SidebarTitle>
{ isAuthor ? 'Author' : 'Featured Mentor' }
</SidebarTitle>
<a href={`https://mentors.codingcoach.io/u/${mentor._id}`} className="block mb-4 w-full">
<a title href={`https://mentors.codingcoach.io/u/${mentor._id}`} className="block mb-4 w-full">
<img src={mentor.avatar} className="w-full" alt={mentor.name} />
</a>
<h3 className="font-body mb-1 text-lg truncate" title={mentor.name}>
<a href={`https://mentors.codingcoach.io/u/${mentor._id}`} className="hover:underline">{mentor.name}</a>
<a aria-label={mentor.name} href={`https://mentors.codingcoach.io/u/${mentor._id}`} className="hover:underline">{mentor.name}</a>
</h3>
{mentor.tags &&
<p className="font-body mb-1 text-xs uppercase truncate text-secondary-dark">
Expand All @@ -75,7 +75,7 @@ function LatestMentors({ mentors }) {
{mentors.map(mentor =>
<li key={mentor.name} className="mb-2">
<h4 className="font-body">
<a href={`https://mentors.codingcoach.io/u/${mentor._id}`} className="hover:underline">{mentor.name}</a>
<a aria-label={mentor.name} href={`https://mentors.codingcoach.io/u/${mentor._id}`} className="hover:underline">{mentor.name}</a>
</h4>
<p className="uppercase text-xs text-secondary-dark truncate">{mentor.tags.join(', ')}</p>
</li>
Expand Down Expand Up @@ -109,7 +109,7 @@ function TwitchAd() {
return (
<div className="mb-12 pt-4 md:mr-4 md:flex-1 lg:flex-none">
<SidebarTitle>Follow us in Twitch</SidebarTitle>
<a href="https://www.twitch.tv/codingcoach/">
<a aria-label="Access our page on Twitch" href="https://www.twitch.tv/codingcoach/">
<img src={twitchImage} alt="Twitch Logo" />
</a>
</div>
Expand All @@ -120,7 +120,7 @@ function StoreAd() {
return (
<div className="mb-12 pt-4 md:mr-4 md:flex-1 lg:flex-none">
<SidebarTitle>Get the T-Shirt</SidebarTitle>
<a href="https://shop.spreadshirt.com/coding-coach" target="_blank" rel="noopener noreferrer">
<a aria-label="Buy coding-coach merchandise" href="https://shop.spreadshirt.com/coding-coach" target="_blank" rel="noopener noreferrer">
<img src={tshirtImage} alt="Coding Coach T-Shirt" />
</a>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/404.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ const NotFoundPage = () => (
<Link to="/">home page</Link> would be a good idea. You might want to{' '}
<Link to="/blog">read the blog</Link>, we have very interesting
articles and tutorials! Maybe looking for{' '}
<a href="https://mentors.codingcoach.io">a mentor</a> to improve your
<a aria-label="Link to page with all the mentors" href="https://mentors.codingcoach.io">a mentor</a> to improve your
career?
</p>
<p>
How did you get here? Is this a broken link within the blog? Or maybe
a link from a third party website? Please{' '}
<a href="mailto:[email protected]">let us know</a> and we will fix it
<a aria-label="Send email to the page admin" href="mailto:[email protected]">let us know</a> and we will fix it
ASAP!
</p>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/pages/about.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ function Profile({ className, highlight, image, name, title, to }) {

return (
<div className={css}>
<a href={to}>
<img src={image} alt={name} title={name} />
<a aria-label={name} href={to}>
<img aria-label={name} src={image} alt={name} title={name} />
</a>
<h3 className={titleCss}>
<a href={to} className="hover:underline" title={name}>
<a aria-label={name} href={to} className="hover:underline" title={name}>
{name}
</a>
</h3>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/blog.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function PostExcerpt({ author, data, excerpt, fields }) {
</Link>
</h2>
<p className="mb-1 font-body text-sm uppercase text-secondary-dark">
<a href={author.frontmatter.link} className="hover:underline">{author.frontmatter.name}</a> <span className="inline-block mx-2">&middot;</span>{' '}
<a aria-label={author.frontmatter.name} href={author.frontmatter.link} className="hover:underline">{author.frontmatter.name}</a> <span className="inline-block mx-2">&middot;</span>{' '}
{data.date} <span className="inline-block mx-2">&middot;</span>{' '}
{fields.readingTime.text}
</p>
Expand Down
2 changes: 1 addition & 1 deletion src/templates/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default function PostTemplate({ data }) {
{frontmatter.title}
</h1>
<p className="mb-4 font-body uppercase text-xs md:text-sm">
<a href={author.frontmatter.link} className="hover:underline">{author.frontmatter.name}</a>{' '}
<a aria-label={author.frontmatter.name} href={author.frontmatter.link} className="hover:underline">{author.frontmatter.name}</a>{' '}
<span className="inline-block mx-2">&middot;</span>{' '}
{frontmatter.date}{' '}
<span className="inline-block mx-2">&middot;</span>{' '}
Expand Down