diff --git a/src/checkbox/main.scss b/src/checkbox/main.scss
index bc5102e470..1f2d4452d9 100644
--- a/src/checkbox/main.scss
+++ b/src/checkbox/main.scss
@@ -123,6 +123,9 @@
border-color: $checkbox-hovered-border-color;
background-color: $checkbox-hovered-bg-color;
}
+ #{$checkbox-prefix}-label {
+ cursor: pointer;
+ }
}
&.indeterminate:not(.disabled):hover,
diff --git a/src/radio/main.scss b/src/radio/main.scss
index 491f544914..0bd8e77a1a 100644
--- a/src/radio/main.scss
+++ b/src/radio/main.scss
@@ -22,6 +22,7 @@
width: $radio-width;
height: $radio-width;
margin: 0;
+ cursor: pointer;
}
}
@@ -108,6 +109,9 @@
border-color: $radio-hovered-border-color;
background-color: $radio-hovered-bg-color;
}
+ #{$radio-prefix}-label {
+ cursor: pointer;
+ }
}
&.checked:not(.disabled):hover,
@@ -274,7 +278,6 @@
top: 0;
left: 0;
margin: 0;
- cursor: pointer;
}
}
&-group {
diff --git a/test/radio/a11y-spec.js b/test/radio/a11y-spec.js
index c6c48958c6..293ab74256 100644
--- a/test/radio/a11y-spec.js
+++ b/test/radio/a11y-spec.js
@@ -1,6 +1,7 @@
import React from 'react';
-import Enzyme from 'enzyme';
+import Enzyme, { mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
+import assert from 'power-assert';
import Radio from '../../src/radio/index';
import '../../src/radio/style';
import { unmount, testReact } from '../util/a11y/validate';
@@ -98,4 +99,37 @@ describe('Radio A11y', () => {
);
return wrapper;
});
+
+ it('should add tabIndex for first Radio Item', async () => {
+ const wrapper = mount(
+
+ ={true}
+ 梨子
+
+
+ 苹果
+
+
+ );
+ wrapper.update();
+ assert(wrapper.find("input#pear").at(0).getDOMNode().tabIndex === 0);
+ });
+
+ it('should not add tabIndex for non Radio Item', async () => {
+ const wrapper = mount(
+
+
+
+ 梨子
+
+
+
+
+ 苹果
+
+
+
+ );
+ assert(wrapper.find("div#mywrapper").at(0).getDOMNode().tabIndex === -1);
+ });
});