Skip to content
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

fix (a11y): add accessible name to social buttons and copy button #814

Merged
merged 4 commits into from
Sep 18, 2024
Merged
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
6 changes: 6 additions & 0 deletions src/assets/locales/de/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@
"navigation.contact": "Kontakt",
"navigation.about-us": "Über Uns",
"blog.share": "Artikel teilen",
"blog.share.facebook": "Teilen auf Facebook",
"blog.share.whatsapp": "Teilen auf WhatsApp",
"blog.share.email": "Teilen per E-Mail",
"blog.share.twitter": "Teilen auf X",
"blog.share.linkedin": "Teilen auf LinkedIn",
"blog.copy": "Kopieren",
"blog.copied": "Kopiert",
"blog.follow": "Blog abonnieren",
"blog.pagination": "Seite",
Expand Down
6 changes: 6 additions & 0 deletions src/assets/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@
"navigation.contact": "Contact",
"navigation.about-us": "About",
"blog.share": "Share article",
"blog.share.facebook": "Share on Facebook",
"blog.share.whatsapp": "Share on WhatsApp",
"blog.share.email": "Share via email",
"blog.share.twitter": "Share on X",
"blog.share.linkedin": "Share on LinkedIn",
"blog.copy": "Copy",
"blog.copied": "Copied",
"blog.follow": "Subscribe to blog",
"blog.pagination": "Page",
Expand Down
31 changes: 26 additions & 5 deletions src/components/pages/blog-post/share-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,27 +64,48 @@ export const SharePanel: React.FC<ShareProps> = ({ title }) => {
<SharePanelText>{t('blog.share')}</SharePanelText>
<SocialLinks>
<SocialLinkItem data-testid="facebook">
<FacebookShareButton url={shareUrl}>
<FacebookShareButton
url={shareUrl}
aria-label={t('blog.share.facebook')}
>
<Icon show="facebook" />
</FacebookShareButton>
</SocialLinkItem>
<SocialLinkItem data-testid="whatsapp">
<WhatsappShareButton url={shareUrl} title={title}>
<WhatsappShareButton
url={shareUrl}
title={title}
aria-label={t('blog.share.whatsapp')}
>
<Icon show="whatsapp" />
</WhatsappShareButton>
</SocialLinkItem>
<SocialLinkItem data-testid="email">
<EmailShareButton url={shareUrl} subject={title} body="body">
<EmailShareButton
url={shareUrl}
subject={title}
body="body"
aria-label={t('blog.share.email')}
>
<Icon show="email" />
</EmailShareButton>
</SocialLinkItem>
<SocialLinkItem data-testid="twitter">
<TwitterShareButton url={shareUrl} title={title} hashtags={hashtags}>
<TwitterShareButton
url={shareUrl}
title={title}
hashtags={hashtags}
aria-label={t('blog.share.twitter')}
>
<Icon show="twitter" />
</TwitterShareButton>
</SocialLinkItem>
<SocialLinkItem data-testid="linkedin">
<LinkedinShareButton title={title} url={shareUrl}>
<LinkedinShareButton
title={title}
url={shareUrl}
aria-label={t('blog.share.linkedin')}
>
<Icon show="linked_in" />
</LinkedinShareButton>
</SocialLinkItem>
Expand Down
6 changes: 5 additions & 1 deletion src/components/ui/copy-button/copy-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ export const Copy = ({
</CheckmarkContainer>
</>
) : (
<IconButton icon={'clone'} onClick={handleClick}></IconButton>
<IconButton
icon={'clone'}
onClick={handleClick}
aria-label={t('blog.copy')}
></IconButton>
)}
</CopyWrapper>
);
Expand Down