Skip to content

Commit 3aedf48

Browse files
committed
feat: Breadcrumb accessibility improvements
1 parent 78045b4 commit 3aedf48

File tree

3 files changed

+21
-9
lines changed

3 files changed

+21
-9
lines changed

components/breadcrumb/Breadcrumb.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,11 @@ export default defineComponent({
152152
[prefixCls.value]: true,
153153
[`${prefixCls.value}-rtl`]: direction.value === 'rtl',
154154
};
155-
return <div class={breadcrumbClassName}>{crumbs}</div>;
155+
return (
156+
<nav class={breadcrumbClassName}>
157+
<ol>{crumbs}</ol>
158+
</nav>
159+
);
156160
};
157161
},
158162
});

components/breadcrumb/BreadcrumbItem.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { ExtractPropTypes, PropType } from 'vue';
22
import { defineComponent } from 'vue';
33
import PropTypes from '../_util/vue-types';
44
import { getPropsSlot } from '../_util/props-util';
5-
import DropDown from '../dropdown/dropdown';
5+
import Dropdown from '../dropdown/dropdown';
66
import DownOutlined from '@ant-design/icons-vue/DownOutlined';
77
import useConfigInject from '../_util/hooks/useConfigInject';
88
import type { MouseEventHandler } from '../_util/EventInterface';
@@ -27,18 +27,18 @@ export default defineComponent({
2727
const { prefixCls } = useConfigInject('breadcrumb', props);
2828
/**
2929
* if overlay is have
30-
* Wrap a DropDown
30+
* Wrap a Dropdown
3131
*/
3232
const renderBreadcrumbNode = (breadcrumbItem: JSX.Element, prefixCls: string) => {
3333
const overlay = getPropsSlot(slots, props, 'overlay');
3434
if (overlay) {
3535
return (
36-
<DropDown overlay={overlay} placement="bottom">
36+
<Dropdown overlay={overlay} placement="bottom">
3737
<span class={`${prefixCls}-overlay-link`}>
3838
{breadcrumbItem}
3939
<DownOutlined />
4040
</span>
41-
</DropDown>
41+
</Dropdown>
4242
);
4343
}
4444
return breadcrumbItem;
@@ -66,10 +66,10 @@ export default defineComponent({
6666
link = renderBreadcrumbNode(link, prefixCls.value);
6767
if (children) {
6868
return (
69-
<span class={cls} style={style}>
69+
<li class={cls} style={style}>
7070
{link}
7171
{separator && <span class={`${prefixCls.value}-separator`}>{separator}</span>}
72-
</span>
72+
</li>
7373
);
7474
}
7575
return null;

components/breadcrumb/style/index.less

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@
1313
font-size: @breadcrumb-icon-font-size;
1414
}
1515

16+
ol {
17+
display: flex;
18+
flex-wrap: wrap;
19+
margin: 0;
20+
padding: 0;
21+
list-style: none;
22+
}
23+
1624
a {
1725
color: @breadcrumb-link-color;
1826
transition: color 0.3s;
@@ -22,15 +30,15 @@
2230
}
2331
}
2432

25-
& > span:last-child {
33+
li:last-child {
2634
color: @breadcrumb-last-item-color;
2735

2836
a {
2937
color: @breadcrumb-last-item-color;
3038
}
3139
}
3240

33-
& > span:last-child &-separator {
41+
li:last-child &-separator {
3442
display: none;
3543
}
3644

0 commit comments

Comments
 (0)