Skip to content

Commit 3a45bab

Browse files
authored
fix: breadcrumbs a11y (#996)
* fix: breadcrumbs a11y * fix: requested changes * fix: removed aria-current and extra spacing
1 parent ec3aa89 commit 3a45bab

File tree

2 files changed

+28
-21
lines changed

2 files changed

+28
-21
lines changed

src/components/HeaderBreadcrumbs/HeaderBreadcrumbs.scss

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,38 +6,40 @@ $block: '.#{$ns}header-breadcrumbs';
66
#{$block} {
77
z-index: 11;
88

9+
&__list {
10+
@include reset-list-style();
11+
}
12+
913
&__item {
14+
@include text-size(body-2);
1015
display: inline-block;
1116
}
1217

1318
&__text {
14-
@include text-size(body-2);
1519
@include link();
16-
1720
color: var(--g-color-text-secondary);
1821

19-
&:after {
20-
content: '\a0/ ';
21-
margin: 0 8px 0 6px;
22-
color: var(--g-color-text-secondary);
23-
}
24-
2522
&:hover {
2623
color: var(--g-color-text-primary);
2724
}
2825
}
2926

27+
&__separator {
28+
margin: 0 8px 0 6px;
29+
color: var(--g-color-text-secondary);
30+
}
31+
3032
&_theme_dark {
3133
#{$block}__text {
3234
color: var(--g-color-text-light-secondary);
3335

34-
&:after {
35-
color: var(--g-color-text-light-secondary);
36-
}
37-
3836
&:hover {
3937
color: var(--g-color-text-light-primary);
4038
}
4139
}
40+
41+
#{$block}__separator {
42+
color: var(--g-color-text-light-secondary);
43+
}
4244
}
4345
}

src/components/HeaderBreadcrumbs/HeaderBreadcrumbs.tsx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,19 @@ export default function HeaderBreadcrumbs(props: HeaderBreadCrumbsProps) {
1919
}, [analyticsEvents, handleAnalytics]);
2020

2121
return (
22-
<div className={b({theme}, className)} aria-label={i18n('label')}>
23-
{items?.map((item) => (
24-
<div className={b('item')} key={item.url}>
25-
<a href={item.url} className={b('text')} onClick={onClick}>
26-
{item.text}
27-
</a>
28-
</div>
29-
))}
30-
</div>
22+
<nav className={b({theme}, className)} aria-label={i18n('label')}>
23+
<ol className={b('list')}>
24+
{items?.map(({url, text}) => (
25+
<li className={b('item')} key={url}>
26+
<a href={url} className={b('text')} onClick={onClick}>
27+
{text}
28+
</a>
29+
<span className={b('separator')} aria-hidden>
30+
/
31+
</span>
32+
</li>
33+
))}
34+
</ol>
35+
</nav>
3136
);
3237
}

0 commit comments

Comments
 (0)