refactor(a11y): add linkTitle in social links for more meaningful voiceover

This commit is contained in:
satnaing
2022-11-28 13:38:08 +06:30
parent 307b55ff0f
commit c9f796f4e6
3 changed files with 21 additions and 1 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ const { centered = false } = Astro.props;
<LinkButton <LinkButton
href={social.href} href={social.href}
className="link-button" className="link-button"
title={social.name} title={social.linkTitle}
> >
<Fragment set:html={socialIcons[social.name]} /> <Fragment set:html={socialIcons[social.name]} />
</LinkButton> </LinkButton>
+19
View File
@@ -20,97 +20,116 @@ export const LOGO_IMAGE = {
export const SOCIALS: SocialsObject = [ export const SOCIALS: SocialsObject = [
{ {
name: "Github", name: "Github",
linkTitle: ` ${SITE.title} on Github`,
href: "https://github.com/satnaing/astro-paper", href: "https://github.com/satnaing/astro-paper",
active: true, active: true,
}, },
{ {
name: "Facebook", name: "Facebook",
href: "https://github.com/satnaing/astro-paper", href: "https://github.com/satnaing/astro-paper",
linkTitle: `${SITE.title} on Facebook`,
active: true, active: true,
}, },
{ {
name: "Instagram", name: "Instagram",
href: "https://github.com/satnaing/astro-paper", href: "https://github.com/satnaing/astro-paper",
linkTitle: `${SITE.title} on Instagram`,
active: true, active: true,
}, },
{ {
name: "LinkedIn", name: "LinkedIn",
href: "https://github.com/satnaing/astro-paper", href: "https://github.com/satnaing/astro-paper",
linkTitle: `${SITE.title} on LinkedIn`,
active: true, active: true,
}, },
{ {
name: "Mail", name: "Mail",
href: "mailto:yourmail@gmail.com", href: "mailto:yourmail@gmail.com",
linkTitle: `Send an email to ${SITE.title}`,
active: false, active: false,
}, },
{ {
name: "Twitter", name: "Twitter",
href: "https://github.com/satnaing/astro-paper", href: "https://github.com/satnaing/astro-paper",
linkTitle: `${SITE.title} on Twitter`,
active: false, active: false,
}, },
{ {
name: "Twitch", name: "Twitch",
href: "https://github.com/satnaing/astro-paper", href: "https://github.com/satnaing/astro-paper",
linkTitle: `${SITE.title} on Twitch`,
active: false, active: false,
}, },
{ {
name: "YouTube", name: "YouTube",
href: "https://github.com/satnaing/astro-paper", href: "https://github.com/satnaing/astro-paper",
linkTitle: `${SITE.title} on YouTube`,
active: false, active: false,
}, },
{ {
name: "WhatsApp", name: "WhatsApp",
href: "https://github.com/satnaing/astro-paper", href: "https://github.com/satnaing/astro-paper",
linkTitle: `${SITE.title} on WhatsApp`,
active: false, active: false,
}, },
{ {
name: "Snapchat", name: "Snapchat",
href: "https://github.com/satnaing/astro-paper", href: "https://github.com/satnaing/astro-paper",
linkTitle: `${SITE.title} on Snapchat`,
active: false, active: false,
}, },
{ {
name: "Pinterest", name: "Pinterest",
href: "https://github.com/satnaing/astro-paper", href: "https://github.com/satnaing/astro-paper",
linkTitle: `${SITE.title} on Pinterest`,
active: false, active: false,
}, },
{ {
name: "TikTok", name: "TikTok",
href: "https://github.com/satnaing/astro-paper", href: "https://github.com/satnaing/astro-paper",
linkTitle: `${SITE.title} on TikTok`,
active: false, active: false,
}, },
{ {
name: "CodePen", name: "CodePen",
href: "https://github.com/satnaing/astro-paper", href: "https://github.com/satnaing/astro-paper",
linkTitle: `${SITE.title} on CodePen`,
active: false, active: false,
}, },
{ {
name: "Discord", name: "Discord",
href: "https://github.com/satnaing/astro-paper", href: "https://github.com/satnaing/astro-paper",
linkTitle: `${SITE.title} on Discord`,
active: false, active: false,
}, },
{ {
name: "GitLab", name: "GitLab",
href: "https://github.com/satnaing/astro-paper", href: "https://github.com/satnaing/astro-paper",
linkTitle: `${SITE.title} on GitLab`,
active: false, active: false,
}, },
{ {
name: "Reddit", name: "Reddit",
href: "https://github.com/satnaing/astro-paper", href: "https://github.com/satnaing/astro-paper",
linkTitle: `${SITE.title} on Reddit`,
active: false, active: false,
}, },
{ {
name: "Skype", name: "Skype",
href: "https://github.com/satnaing/astro-paper", href: "https://github.com/satnaing/astro-paper",
linkTitle: `${SITE.title} on Skype`,
active: false, active: false,
}, },
{ {
name: "Steam", name: "Steam",
href: "https://github.com/satnaing/astro-paper", href: "https://github.com/satnaing/astro-paper",
linkTitle: `${SITE.title} on Steam`,
active: false, active: false,
}, },
{ {
name: "Telegram", name: "Telegram",
href: "https://github.com/satnaing/astro-paper", href: "https://github.com/satnaing/astro-paper",
linkTitle: `${SITE.title} on Telegram`,
active: false, active: false,
}, },
]; ];
+1
View File
@@ -14,6 +14,7 @@ export type SocialsObject = {
name: SocialMedia; name: SocialMedia;
href: string; href: string;
active: boolean; active: boolean;
linkTitle: string;
}[]; }[];
export type SocialIcons = { export type SocialIcons = {