Skip to content

Commit 0a419da

Browse files
committed
fix: switch tabIndex not work
1 parent c9f1c26 commit 0a419da

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

components/switch/index.jsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const Switch = {
1818
disabled: PropTypes.bool,
1919
checkedChildren: PropTypes.any,
2020
unCheckedChildren: PropTypes.any,
21-
tabIndex: PropTypes.number,
21+
tabIndex: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
2222
checked: PropTypes.bool,
2323
defaultChecked: PropTypes.bool,
2424
autoFocus: PropTypes.bool,

components/vc-switch/PropTypes.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const switchPropTypes = {
88
// onChange: PropTypes.func,
99
// onMouseUp: PropTypes.func,
1010
// onClick: PropTypes.func,
11-
tabIndex: PropTypes.number,
11+
tabIndex: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
1212
checked: PropTypes.bool.def(false),
1313
defaultChecked: PropTypes.bool.def(false),
1414
autoFocus: PropTypes.bool.def(false),

components/vc-switch/Switch.jsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export default {
7979
},
8080
},
8181
render() {
82-
const { prefixCls, disabled, loadingIcon, ...restProps } = getOptionProps(this);
82+
const { prefixCls, disabled, loadingIcon, tabIndex, ...restProps } = getOptionProps(this);
8383
const checked = this.stateChecked;
8484
const switchClassName = {
8585
[prefixCls]: true,
@@ -99,6 +99,7 @@ export default {
9999
role: 'switch',
100100
'aria-checked': checked,
101101
disabled,
102+
tabIndex,
102103
},
103104
class: switchClassName,
104105
ref: 'refSwitchNode',

0 commit comments

Comments
 (0)