fix: disable jsx-a11y/label-has-associated-control

This commit is contained in:
orzyyyy 2019-08-06 11:55:50 +08:00
parent 8149aa7aba
commit 06c1f1a77c
7 changed files with 2 additions and 85 deletions

View File

@ -142,8 +142,8 @@ class Checkbox extends React.Component<CheckboxProps, {}> {
[`${prefixCls}-indeterminate`]: indeterminate,
});
return (
/* eslint-disable jsx-a11y/label-has-associated-control */
<label
htmlFor="checkbox-label"
className={classString}
style={style}
onMouseEnter={onMouseEnter}

View File

@ -3,7 +3,6 @@
exports[`renders ./components/checkbox/demo/basic.md correctly 1`] = `
<label
class="ant-checkbox-wrapper"
for="checkbox-label"
>
<span
class="ant-checkbox"
@ -29,7 +28,6 @@ exports[`renders ./components/checkbox/demo/check-all.md correctly 1`] = `
>
<label
class="ant-checkbox-wrapper"
for="checkbox-label"
>
<span
class="ant-checkbox ant-checkbox-indeterminate"
@ -53,7 +51,6 @@ exports[`renders ./components/checkbox/demo/check-all.md correctly 1`] = `
>
<label
class="ant-checkbox-group-item ant-checkbox-wrapper ant-checkbox-wrapper-checked"
for="checkbox-label"
>
<span
class="ant-checkbox ant-checkbox-checked"
@ -74,7 +71,6 @@ exports[`renders ./components/checkbox/demo/check-all.md correctly 1`] = `
</label>
<label
class="ant-checkbox-group-item ant-checkbox-wrapper"
for="checkbox-label"
>
<span
class="ant-checkbox"
@ -94,7 +90,6 @@ exports[`renders ./components/checkbox/demo/check-all.md correctly 1`] = `
</label>
<label
class="ant-checkbox-group-item ant-checkbox-wrapper ant-checkbox-wrapper-checked"
for="checkbox-label"
>
<span
class="ant-checkbox ant-checkbox-checked"
@ -124,7 +119,6 @@ exports[`renders ./components/checkbox/demo/controller.md correctly 1`] = `
>
<label
class="ant-checkbox-wrapper ant-checkbox-wrapper-checked"
for="checkbox-label"
>
<span
class="ant-checkbox ant-checkbox-checked"
@ -169,7 +163,6 @@ exports[`renders ./components/checkbox/demo/disabled.md correctly 1`] = `
<div>
<label
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled"
for="checkbox-label"
>
<span
class="ant-checkbox ant-checkbox-disabled"
@ -187,7 +180,6 @@ exports[`renders ./components/checkbox/demo/disabled.md correctly 1`] = `
<br />
<label
class="ant-checkbox-wrapper ant-checkbox-wrapper-disabled"
for="checkbox-label"
>
<span
class="ant-checkbox ant-checkbox-checked ant-checkbox-disabled"
@ -213,7 +205,6 @@ exports[`renders ./components/checkbox/demo/group.md correctly 1`] = `
>
<label
class="ant-checkbox-group-item ant-checkbox-wrapper ant-checkbox-wrapper-checked"
for="checkbox-label"
>
<span
class="ant-checkbox ant-checkbox-checked"
@ -234,7 +225,6 @@ exports[`renders ./components/checkbox/demo/group.md correctly 1`] = `
</label>
<label
class="ant-checkbox-group-item ant-checkbox-wrapper"
for="checkbox-label"
>
<span
class="ant-checkbox"
@ -254,7 +244,6 @@ exports[`renders ./components/checkbox/demo/group.md correctly 1`] = `
</label>
<label
class="ant-checkbox-group-item ant-checkbox-wrapper"
for="checkbox-label"
>
<span
class="ant-checkbox"
@ -280,7 +269,6 @@ exports[`renders ./components/checkbox/demo/group.md correctly 1`] = `
>
<label
class="ant-checkbox-group-item ant-checkbox-wrapper"
for="checkbox-label"
>
<span
class="ant-checkbox"
@ -300,7 +288,6 @@ exports[`renders ./components/checkbox/demo/group.md correctly 1`] = `
</label>
<label
class="ant-checkbox-group-item ant-checkbox-wrapper ant-checkbox-wrapper-checked"
for="checkbox-label"
>
<span
class="ant-checkbox ant-checkbox-checked"
@ -321,7 +308,6 @@ exports[`renders ./components/checkbox/demo/group.md correctly 1`] = `
</label>
<label
class="ant-checkbox-group-item ant-checkbox-wrapper"
for="checkbox-label"
>
<span
class="ant-checkbox"
@ -347,7 +333,6 @@ exports[`renders ./components/checkbox/demo/group.md correctly 1`] = `
>
<label
class="ant-checkbox-group-item ant-checkbox-wrapper ant-checkbox-wrapper-checked ant-checkbox-wrapper-disabled"
for="checkbox-label"
>
<span
class="ant-checkbox ant-checkbox-checked ant-checkbox-disabled"
@ -369,7 +354,6 @@ exports[`renders ./components/checkbox/demo/group.md correctly 1`] = `
</label>
<label
class="ant-checkbox-group-item ant-checkbox-wrapper ant-checkbox-wrapper-disabled"
for="checkbox-label"
>
<span
class="ant-checkbox ant-checkbox-disabled"
@ -390,7 +374,6 @@ exports[`renders ./components/checkbox/demo/group.md correctly 1`] = `
</label>
<label
class="ant-checkbox-group-item ant-checkbox-wrapper ant-checkbox-wrapper-disabled"
for="checkbox-label"
>
<span
class="ant-checkbox ant-checkbox-disabled"
@ -426,7 +409,6 @@ exports[`renders ./components/checkbox/demo/layout.md correctly 1`] = `
>
<label
class="ant-checkbox-wrapper"
for="checkbox-label"
>
<span
class="ant-checkbox"
@ -450,7 +432,6 @@ exports[`renders ./components/checkbox/demo/layout.md correctly 1`] = `
>
<label
class="ant-checkbox-wrapper"
for="checkbox-label"
>
<span
class="ant-checkbox"
@ -474,7 +455,6 @@ exports[`renders ./components/checkbox/demo/layout.md correctly 1`] = `
>
<label
class="ant-checkbox-wrapper"
for="checkbox-label"
>
<span
class="ant-checkbox"
@ -498,7 +478,6 @@ exports[`renders ./components/checkbox/demo/layout.md correctly 1`] = `
>
<label
class="ant-checkbox-wrapper"
for="checkbox-label"
>
<span
class="ant-checkbox"
@ -522,7 +501,6 @@ exports[`renders ./components/checkbox/demo/layout.md correctly 1`] = `
>
<label
class="ant-checkbox-wrapper"
for="checkbox-label"
>
<span
class="ant-checkbox"

View File

@ -6,7 +6,6 @@ exports[`CheckboxGroup passes prefixCls down to checkbox 1`] = `
>
<label
class="my-checkbox-group-item my-checkbox-wrapper"
for="checkbox-label"
>
<span
class="my-checkbox"
@ -26,7 +25,6 @@ exports[`CheckboxGroup passes prefixCls down to checkbox 1`] = `
</label>
<label
class="my-checkbox-group-item my-checkbox-wrapper"
for="checkbox-label"
>
<span
class="my-checkbox"

View File

@ -3,7 +3,6 @@
exports[`renders ./components/radio/demo/basic.md correctly 1`] = `
<label
class="ant-radio-wrapper"
for="ant-radio-wrapper"
>
<span
class="ant-radio"
@ -26,7 +25,6 @@ exports[`renders ./components/radio/demo/disable.md correctly 1`] = `
<div>
<label
class="ant-radio-wrapper ant-radio-wrapper-disabled"
for="ant-radio-wrapper ant-radio-wrapper-disabled"
>
<span
class="ant-radio ant-radio-disabled"
@ -47,7 +45,6 @@ exports[`renders ./components/radio/demo/disable.md correctly 1`] = `
<br />
<label
class="ant-radio-wrapper ant-radio-wrapper-disabled"
for="ant-radio-wrapper ant-radio-wrapper-disabled"
>
<span
class="ant-radio ant-radio-checked ant-radio-disabled"
@ -89,7 +86,6 @@ exports[`renders ./components/radio/demo/radiobutton.md correctly 1`] = `
>
<label
class="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
for="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
>
<span
class="ant-radio-button ant-radio-button-checked"
@ -110,7 +106,6 @@ exports[`renders ./components/radio/demo/radiobutton.md correctly 1`] = `
</label>
<label
class="ant-radio-button-wrapper"
for="ant-radio-button-wrapper"
>
<span
class="ant-radio-button"
@ -130,7 +125,6 @@ exports[`renders ./components/radio/demo/radiobutton.md correctly 1`] = `
</label>
<label
class="ant-radio-button-wrapper"
for="ant-radio-button-wrapper"
>
<span
class="ant-radio-button"
@ -150,7 +144,6 @@ exports[`renders ./components/radio/demo/radiobutton.md correctly 1`] = `
</label>
<label
class="ant-radio-button-wrapper"
for="ant-radio-button-wrapper"
>
<span
class="ant-radio-button"
@ -178,7 +171,6 @@ exports[`renders ./components/radio/demo/radiobutton.md correctly 1`] = `
>
<label
class="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
for="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
>
<span
class="ant-radio-button ant-radio-button-checked"
@ -199,7 +191,6 @@ exports[`renders ./components/radio/demo/radiobutton.md correctly 1`] = `
</label>
<label
class="ant-radio-button-wrapper ant-radio-button-wrapper-disabled"
for="ant-radio-button-wrapper ant-radio-button-wrapper-disabled"
>
<span
class="ant-radio-button ant-radio-button-disabled"
@ -220,7 +211,6 @@ exports[`renders ./components/radio/demo/radiobutton.md correctly 1`] = `
</label>
<label
class="ant-radio-button-wrapper"
for="ant-radio-button-wrapper"
>
<span
class="ant-radio-button"
@ -240,7 +230,6 @@ exports[`renders ./components/radio/demo/radiobutton.md correctly 1`] = `
</label>
<label
class="ant-radio-button-wrapper"
for="ant-radio-button-wrapper"
>
<span
class="ant-radio-button"
@ -268,7 +257,6 @@ exports[`renders ./components/radio/demo/radiobutton.md correctly 1`] = `
>
<label
class="ant-radio-button-wrapper ant-radio-button-wrapper-checked ant-radio-button-wrapper-disabled"
for="ant-radio-button-wrapper ant-radio-button-wrapper-checked ant-radio-button-wrapper-disabled"
>
<span
class="ant-radio-button ant-radio-button-checked ant-radio-button-disabled"
@ -290,7 +278,6 @@ exports[`renders ./components/radio/demo/radiobutton.md correctly 1`] = `
</label>
<label
class="ant-radio-button-wrapper ant-radio-button-wrapper-disabled"
for="ant-radio-button-wrapper ant-radio-button-wrapper-disabled"
>
<span
class="ant-radio-button ant-radio-button-disabled"
@ -311,7 +298,6 @@ exports[`renders ./components/radio/demo/radiobutton.md correctly 1`] = `
</label>
<label
class="ant-radio-button-wrapper ant-radio-button-wrapper-disabled"
for="ant-radio-button-wrapper ant-radio-button-wrapper-disabled"
>
<span
class="ant-radio-button ant-radio-button-disabled"
@ -332,7 +318,6 @@ exports[`renders ./components/radio/demo/radiobutton.md correctly 1`] = `
</label>
<label
class="ant-radio-button-wrapper ant-radio-button-wrapper-disabled"
for="ant-radio-button-wrapper ant-radio-button-wrapper-disabled"
>
<span
class="ant-radio-button ant-radio-button-disabled"
@ -364,7 +349,6 @@ exports[`renders ./components/radio/demo/radiobutton-solid.md correctly 1`] = `
>
<label
class="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
for="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
>
<span
class="ant-radio-button ant-radio-button-checked"
@ -385,7 +369,6 @@ exports[`renders ./components/radio/demo/radiobutton-solid.md correctly 1`] = `
</label>
<label
class="ant-radio-button-wrapper"
for="ant-radio-button-wrapper"
>
<span
class="ant-radio-button"
@ -405,7 +388,6 @@ exports[`renders ./components/radio/demo/radiobutton-solid.md correctly 1`] = `
</label>
<label
class="ant-radio-button-wrapper"
for="ant-radio-button-wrapper"
>
<span
class="ant-radio-button"
@ -425,7 +407,6 @@ exports[`renders ./components/radio/demo/radiobutton-solid.md correctly 1`] = `
</label>
<label
class="ant-radio-button-wrapper"
for="ant-radio-button-wrapper"
>
<span
class="ant-radio-button"
@ -453,7 +434,6 @@ exports[`renders ./components/radio/demo/radiobutton-solid.md correctly 1`] = `
>
<label
class="ant-radio-button-wrapper"
for="ant-radio-button-wrapper"
>
<span
class="ant-radio-button"
@ -473,7 +453,6 @@ exports[`renders ./components/radio/demo/radiobutton-solid.md correctly 1`] = `
</label>
<label
class="ant-radio-button-wrapper ant-radio-button-wrapper-disabled"
for="ant-radio-button-wrapper ant-radio-button-wrapper-disabled"
>
<span
class="ant-radio-button ant-radio-button-disabled"
@ -494,7 +473,6 @@ exports[`renders ./components/radio/demo/radiobutton-solid.md correctly 1`] = `
</label>
<label
class="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
for="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
>
<span
class="ant-radio-button ant-radio-button-checked"
@ -515,7 +493,6 @@ exports[`renders ./components/radio/demo/radiobutton-solid.md correctly 1`] = `
</label>
<label
class="ant-radio-button-wrapper"
for="ant-radio-button-wrapper"
>
<span
class="ant-radio-button"
@ -544,7 +521,6 @@ exports[`renders ./components/radio/demo/radiogroup.md correctly 1`] = `
>
<label
class="ant-radio-wrapper ant-radio-wrapper-checked"
for="ant-radio-wrapper ant-radio-wrapper-checked"
>
<span
class="ant-radio ant-radio-checked"
@ -565,7 +541,6 @@ exports[`renders ./components/radio/demo/radiogroup.md correctly 1`] = `
</label>
<label
class="ant-radio-wrapper"
for="ant-radio-wrapper"
>
<span
class="ant-radio"
@ -585,7 +560,6 @@ exports[`renders ./components/radio/demo/radiogroup.md correctly 1`] = `
</label>
<label
class="ant-radio-wrapper"
for="ant-radio-wrapper"
>
<span
class="ant-radio"
@ -605,7 +579,6 @@ exports[`renders ./components/radio/demo/radiogroup.md correctly 1`] = `
</label>
<label
class="ant-radio-wrapper"
for="ant-radio-wrapper"
>
<span
class="ant-radio"
@ -632,7 +605,6 @@ exports[`renders ./components/radio/demo/radiogroup-more.md correctly 1`] = `
>
<label
class="ant-radio-wrapper ant-radio-wrapper-checked"
for="ant-radio-wrapper ant-radio-wrapper-checked"
style="display:block;height:30px;line-height:30px"
>
<span
@ -654,7 +626,6 @@ exports[`renders ./components/radio/demo/radiogroup-more.md correctly 1`] = `
</label>
<label
class="ant-radio-wrapper"
for="ant-radio-wrapper"
style="display:block;height:30px;line-height:30px"
>
<span
@ -675,7 +646,6 @@ exports[`renders ./components/radio/demo/radiogroup-more.md correctly 1`] = `
</label>
<label
class="ant-radio-wrapper"
for="ant-radio-wrapper"
style="display:block;height:30px;line-height:30px"
>
<span
@ -696,7 +666,6 @@ exports[`renders ./components/radio/demo/radiogroup-more.md correctly 1`] = `
</label>
<label
class="ant-radio-wrapper"
for="ant-radio-wrapper"
style="display:block;height:30px;line-height:30px"
>
<span
@ -725,7 +694,6 @@ exports[`renders ./components/radio/demo/radiogroup-options.md correctly 1`] = `
>
<label
class="ant-radio-wrapper ant-radio-wrapper-checked"
for="ant-radio-wrapper ant-radio-wrapper-checked"
>
<span
class="ant-radio ant-radio-checked"
@ -746,7 +714,6 @@ exports[`renders ./components/radio/demo/radiogroup-options.md correctly 1`] = `
</label>
<label
class="ant-radio-wrapper"
for="ant-radio-wrapper"
>
<span
class="ant-radio"
@ -766,7 +733,6 @@ exports[`renders ./components/radio/demo/radiogroup-options.md correctly 1`] = `
</label>
<label
class="ant-radio-wrapper"
for="ant-radio-wrapper"
>
<span
class="ant-radio"
@ -790,7 +756,6 @@ exports[`renders ./components/radio/demo/radiogroup-options.md correctly 1`] = `
>
<label
class="ant-radio-wrapper ant-radio-wrapper-checked"
for="ant-radio-wrapper ant-radio-wrapper-checked"
>
<span
class="ant-radio ant-radio-checked"
@ -811,7 +776,6 @@ exports[`renders ./components/radio/demo/radiogroup-options.md correctly 1`] = `
</label>
<label
class="ant-radio-wrapper"
for="ant-radio-wrapper"
>
<span
class="ant-radio"
@ -831,7 +795,6 @@ exports[`renders ./components/radio/demo/radiogroup-options.md correctly 1`] = `
</label>
<label
class="ant-radio-wrapper"
for="ant-radio-wrapper"
>
<span
class="ant-radio"
@ -855,7 +818,6 @@ exports[`renders ./components/radio/demo/radiogroup-options.md correctly 1`] = `
>
<label
class="ant-radio-wrapper ant-radio-wrapper-checked"
for="ant-radio-wrapper ant-radio-wrapper-checked"
>
<span
class="ant-radio ant-radio-checked"
@ -876,7 +838,6 @@ exports[`renders ./components/radio/demo/radiogroup-options.md correctly 1`] = `
</label>
<label
class="ant-radio-wrapper"
for="ant-radio-wrapper"
>
<span
class="ant-radio"
@ -896,7 +857,6 @@ exports[`renders ./components/radio/demo/radiogroup-options.md correctly 1`] = `
</label>
<label
class="ant-radio-wrapper"
for="ant-radio-wrapper"
>
<span
class="ant-radio"
@ -924,7 +884,6 @@ exports[`renders ./components/radio/demo/radiogroup-with-name.md correctly 1`] =
>
<label
class="ant-radio-wrapper ant-radio-wrapper-checked"
for="ant-radio-wrapper ant-radio-wrapper-checked"
>
<span
class="ant-radio ant-radio-checked"
@ -946,7 +905,6 @@ exports[`renders ./components/radio/demo/radiogroup-with-name.md correctly 1`] =
</label>
<label
class="ant-radio-wrapper"
for="ant-radio-wrapper"
>
<span
class="ant-radio"
@ -967,7 +925,6 @@ exports[`renders ./components/radio/demo/radiogroup-with-name.md correctly 1`] =
</label>
<label
class="ant-radio-wrapper"
for="ant-radio-wrapper"
>
<span
class="ant-radio"
@ -988,7 +945,6 @@ exports[`renders ./components/radio/demo/radiogroup-with-name.md correctly 1`] =
</label>
<label
class="ant-radio-wrapper"
for="ant-radio-wrapper"
>
<span
class="ant-radio"
@ -1018,7 +974,6 @@ exports[`renders ./components/radio/demo/size.md correctly 1`] = `
>
<label
class="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
for="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
>
<span
class="ant-radio-button ant-radio-button-checked"
@ -1039,7 +994,6 @@ exports[`renders ./components/radio/demo/size.md correctly 1`] = `
</label>
<label
class="ant-radio-button-wrapper"
for="ant-radio-button-wrapper"
>
<span
class="ant-radio-button"
@ -1059,7 +1013,6 @@ exports[`renders ./components/radio/demo/size.md correctly 1`] = `
</label>
<label
class="ant-radio-button-wrapper"
for="ant-radio-button-wrapper"
>
<span
class="ant-radio-button"
@ -1079,7 +1032,6 @@ exports[`renders ./components/radio/demo/size.md correctly 1`] = `
</label>
<label
class="ant-radio-button-wrapper"
for="ant-radio-button-wrapper"
>
<span
class="ant-radio-button"
@ -1107,7 +1059,6 @@ exports[`renders ./components/radio/demo/size.md correctly 1`] = `
>
<label
class="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
for="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
>
<span
class="ant-radio-button ant-radio-button-checked"
@ -1128,7 +1079,6 @@ exports[`renders ./components/radio/demo/size.md correctly 1`] = `
</label>
<label
class="ant-radio-button-wrapper"
for="ant-radio-button-wrapper"
>
<span
class="ant-radio-button"
@ -1148,7 +1098,6 @@ exports[`renders ./components/radio/demo/size.md correctly 1`] = `
</label>
<label
class="ant-radio-button-wrapper"
for="ant-radio-button-wrapper"
>
<span
class="ant-radio-button"
@ -1168,7 +1117,6 @@ exports[`renders ./components/radio/demo/size.md correctly 1`] = `
</label>
<label
class="ant-radio-button-wrapper"
for="ant-radio-button-wrapper"
>
<span
class="ant-radio-button"
@ -1196,7 +1144,6 @@ exports[`renders ./components/radio/demo/size.md correctly 1`] = `
>
<label
class="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
for="ant-radio-button-wrapper ant-radio-button-wrapper-checked"
>
<span
class="ant-radio-button ant-radio-button-checked"
@ -1217,7 +1164,6 @@ exports[`renders ./components/radio/demo/size.md correctly 1`] = `
</label>
<label
class="ant-radio-button-wrapper"
for="ant-radio-button-wrapper"
>
<span
class="ant-radio-button"
@ -1237,7 +1183,6 @@ exports[`renders ./components/radio/demo/size.md correctly 1`] = `
</label>
<label
class="ant-radio-button-wrapper"
for="ant-radio-button-wrapper"
>
<span
class="ant-radio-button"
@ -1257,7 +1202,6 @@ exports[`renders ./components/radio/demo/size.md correctly 1`] = `
</label>
<label
class="ant-radio-button-wrapper"
for="ant-radio-button-wrapper"
>
<span
class="ant-radio-button"

View File

@ -6,7 +6,6 @@ exports[`Radio passes prefixCls down to radio 1`] = `
>
<label
class="my-radio-wrapper"
for="my-radio-wrapper"
>
<span
class="my-radio"
@ -26,7 +25,6 @@ exports[`Radio passes prefixCls down to radio 1`] = `
</label>
<label
class="my-radio-wrapper"
for="my-radio-wrapper"
>
<span
class="my-radio"

View File

@ -3,7 +3,6 @@
exports[`Radio should render correctly 1`] = `
<label
class="customized ant-radio-wrapper"
for="customized ant-radio-wrapper"
>
<span
class="ant-radio"

View File

@ -74,8 +74,8 @@ export default class Radio extends React.Component<RadioProps, {}> {
});
return (
/* eslint-disable jsx-a11y/label-has-associated-control */
<label
htmlFor={wrapperClassString}
className={wrapperClassString}
style={style}
onMouseEnter={props.onMouseEnter}