Skip to content

Commit 4461115

Browse files
authored
fix: remove duplicate radio role and optimize aria attributes (#317)
1 parent 6fc03b2 commit 4461115

File tree

5 files changed

+23
-89
lines changed

5 files changed

+23
-89
lines changed

.dumirc.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
import { defineConfig } from 'dumi';
2+
import path from 'path';
23

34
const basePath = process.env.GH_PAGES ? '/segmented/' : '/';
45
const publicPath = process.env.GH_PAGES ? '/segmented/' : '/';
56

67
export default defineConfig({
7-
favicons: [
8-
'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
9-
],
8+
favicons: ['https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'],
109
themeConfig: {
1110
name: 'Segmented',
12-
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4'
11+
logo: 'https://avatars0.githubusercontent.com/u/9441414?s=200&v=4',
1312
},
1413
outputPath: '.doc',
1514
exportStatic: {},
1615
base: basePath,
1716
publicPath,
17+
alias: {
18+
'rc-segmented': path.resolve(__dirname, 'src/index.tsx'),
19+
},
1820
});

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"devDependencies": {
5555
"@rc-component/father-plugin": "^2.0.1",
5656
"@rc-component/np": "^1.0.0",
57-
"@testing-library/jest-dom": "^5.16.5",
57+
"@testing-library/jest-dom": "^6.9.1",
5858
"@testing-library/react": "^14.2.1",
5959
"@testing-library/user-event": "^14.5.2",
6060
"@types/jest": "^29.2.4",

src/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,6 @@ const InternalSegmentedOption: React.FC<{
151151
<div
152152
className={clsx(`${prefixCls}-item-label`, segmentedClassNames?.label)}
153153
title={title}
154-
role="radio"
155-
aria-checked={checked}
156154
style={styles?.label}
157155
>
158156
{label}
@@ -308,6 +306,7 @@ const Segmented = React.forwardRef<HTMLDivElement, SegmentedProps>(
308306
role="radiogroup"
309307
aria-label="segmented control"
310308
tabIndex={disabled ? undefined : 0}
309+
aria-orientation={vertical ? 'vertical' : 'horizontal'}
311310
style={style}
312311
{...divProps}
313312
className={clsx(

0 commit comments

Comments
 (0)