Skip to content

Commit 9869d8c

Browse files
authored
fix: added title and aria-label to 'a' tag and button (#531)
* fix: added title and aria-label to 'a' tag and button * fix: add destructurization of props * fix: add destructurization of props
1 parent d16b17d commit 9869d8c

File tree

4 files changed

+19
-8
lines changed

4 files changed

+19
-8
lines changed

src/blocks/Icons/Icons.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,20 @@ const Icons = ({title, size = 's', items}: IconsBlockProps) => {
2424
{title && <Title className={b('header')} title={title} colSizes={{all: 12}} />}
2525
{items.map((item) => {
2626
const itemContent = getItemContent(item);
27-
return item.url ? (
27+
const {url, text} = item;
28+
return url ? (
2829
<a
2930
className={b('item')}
30-
key={item.url}
31-
href={item.url}
32-
{...getLinkProps(item.url, hostname)}
31+
key={url}
32+
href={url}
33+
aria-label={text}
34+
title={text}
35+
{...getLinkProps(url, hostname)}
3336
>
3437
{itemContent}
3538
</a>
3639
) : (
37-
<div className={b('item')} key={item.url}>
40+
<div className={b('item')} key={url}>
3841
{itemContent}
3942
</div>
4043
);

src/components/VideoBlock/VideoBlock.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ const VideoBlock = (props: VideoBlockProps) => {
151151
containerClassName={b('image-wrapper')}
152152
/>
153153
{playButton || (
154-
<button className={b('button')}>
154+
<button title="Play" className={b('button')}>
155155
<Icon className={b('icon')} data={PlayVideo} size={24} />
156156
</button>
157157
)}

src/navigation/components/NavigationItem/components/NavigationLink/NavigationLink.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export const NavigationLink: React.FC<NavigationLinkProps> = (props) => {
3838
} else {
3939
return (
4040
<RouterLink href={url} passHref>
41-
<a {...rest} className={classes}>
41+
<a title={text} {...rest} className={classes}>
4242
{content}
4343
</a>
4444
</RouterLink>

src/navigation/components/SocialIcon/SocialIcon.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,17 @@ export interface NavigationSocialItemOwnProps extends NavigationSocialItem {
1515

1616
const SocialIcon: React.FC<NavigationSocialItemOwnProps> = ({icon, url, className}) => {
1717
const iconData = getMediaImage(icon);
18+
const {alt} = iconData;
1819

1920
return (
20-
<a href={url} target="_blank" rel="noopener noreferrer" className={b(null, className)}>
21+
<a
22+
href={url}
23+
aria-label={alt}
24+
title={alt}
25+
target="_blank"
26+
rel="noopener noreferrer"
27+
className={b(null, className)}
28+
>
2129
<Image className={b('icon')} {...iconData} />
2230
</a>
2331
);

0 commit comments

Comments
 (0)