Fix eslint6 jsx-a11y/label-has-for

[MAILPOET-1140]
This commit is contained in:
Pavel Dohnal
2018-03-15 10:56:31 +00:00
parent 3f219379d5
commit b5a322a8e1
5 changed files with 8 additions and 5 deletions

View File

@ -31,7 +31,6 @@
"react/jsx-boolean-value": 0, "react/jsx-boolean-value": 0,
"react/jsx-no-bind": 0, "react/jsx-no-bind": 0,
"react/no-array-index-key": 0, "react/no-array-index-key": 0,
"jsx-a11y/label-has-for": 0,
"jsx-a11y/no-static-element-interactions": 0, "jsx-a11y/no-static-element-interactions": 0,
"jsx-a11y/alt-text": 0, "jsx-a11y/alt-text": 0,
"func-names": 0, "func-names": 0,

View File

@ -20,7 +20,7 @@ define([
const options = Object.keys(this.props.field.values).map( const options = Object.keys(this.props.field.values).map(
(value, index) => ( (value, index) => (
<p key={`checkbox-${index}`}> <p key={`checkbox-${index}`}>
<label> <label htmlFor={this.props.field.name}>
<input <input
ref={(c) => { this.checkbox = c; }} ref={(c) => { this.checkbox = c; }}
type="checkbox" type="checkbox"
@ -28,6 +28,7 @@ define([
checked={isChecked} checked={isChecked}
onChange={this.onValueChange} onChange={this.onValueChange}
name={this.props.field.name} name={this.props.field.name}
id={this.props.field.name}
/> />
{ this.props.field.values[value] } { this.props.field.values[value] }
</label> </label>

View File

@ -14,13 +14,14 @@ define([
const options = Object.keys(this.props.field.values).map( const options = Object.keys(this.props.field.values).map(
(value, index) => ( (value, index) => (
<p key={`radio-${index}`}> <p key={`radio-${index}`}>
<label> <label htmlFor={this.props.field.name}>
<input <input
type="radio" type="radio"
checked={selectedValue === value} checked={selectedValue === value}
value={value} value={value}
onChange={this.props.onValueChange} onChange={this.props.onValueChange}
name={this.props.field.name} name={this.props.field.name}
id={this.props.field.name}
/> />
{ this.props.field.values[value] } { this.props.field.values[value] }
</label> </label>

View File

@ -32,12 +32,13 @@ const ListingHeader = React.createClass({
<th <th
className="manage-column column-cb check-column" className="manage-column column-cb check-column"
> >
<label className="screen-reader-text"> <label className="screen-reader-text" htmlFor="select_all">
{MailPoet.I18n.t('selectAll')} {MailPoet.I18n.t('selectAll')}
</label> </label>
<input <input
type="checkbox" type="checkbox"
name="select_all" name="select_all"
id="select_all"
ref={(c) => { this.toggle = c; }} ref={(c) => { this.toggle = c; }}
checked={this.props.selection} checked={this.props.selection}
onChange={this.handleSelectItems} onChange={this.handleSelectItems}

View File

@ -43,7 +43,7 @@ const ListingItem = React.createClass({
if (this.props.is_selectable === true) { if (this.props.is_selectable === true) {
checkbox = ( checkbox = (
<th className="check-column" scope="row"> <th className="check-column" scope="row">
<label className="screen-reader-text">{ <label className="screen-reader-text" htmlFor={`listing-row-checkbox-${this.props.item.id}`}>{
`Select ${this.props.item[this.props.columns[0].name]}` `Select ${this.props.item[this.props.columns[0].name]}`
}</label> }</label>
<input <input
@ -54,6 +54,7 @@ const ListingItem = React.createClass({
} }
onChange={this.handleSelectItem} onChange={this.handleSelectItem}
disabled={this.props.selection === 'all'} disabled={this.props.selection === 'all'}
id={`listing-row-checkbox-${this.props.item.id}`}
/> />
</th> </th>
); );