Skip to content

Commit

Permalink
Disable jsx-a11y/no-onchange lint rule (#50023)
Browse files Browse the repository at this point in the history
* Disable the jsx-a11y/no-onchange lint rule

As outlined in jsx-eslint/eslint-plugin-jsx-a11y#398, the rule is no
longer relevant. It goes against the official React docs and keyboard
navigation in <select> controls works fine using the `onChange` prop.
The issue was in browsers older than IE 11.

The rule will be removed from jsx-a11y/recommended in a future release.

* Remove unnecessary lint rule exceptions
  • Loading branch information
p-jackson authored Feb 14, 2021
1 parent f289005 commit 805a247
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 12 deletions.
4 changes: 4 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,10 @@ module.exports = {
// i18n-calypso translate triggers false failures
'jsx-a11y/anchor-has-content': 'off',

// Deprecated rule, the problems using <select> with keyboards this addressed don't appear to be an issue anymore
// https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/issues/398
'jsx-a11y/no-onchange': 'off',

'no-restricted-imports': [
2,
{
Expand Down
2 changes: 0 additions & 2 deletions client/blocks/site-address-changer/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* eslint-disable jsx-a11y/no-onchange */

/**
* External dependencies
*/
Expand Down
2 changes: 0 additions & 2 deletions client/components/forms/form-country-select/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import FormSelect from 'calypso/components/forms/form-select';
*/
import './style.scss';

/* eslint-disable jsx-a11y/no-onchange */
export class FormCountrySelect extends Component {
static propTypes = {
countriesList: PropTypes.array.isRequired,
Expand Down Expand Up @@ -74,6 +73,5 @@ export class FormCountrySelect extends Component {
);
}
}
/* eslint-enable jsx-a11y/no-onchange */

export default localize( FormCountrySelect );
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ function EbanxTefFields() {
function BankSelector( { id, value, onChange, label, isError, errorMessage, disabled } ) {
const { __ } = useI18n();
const bankOptions = getBankOptions( __ );
/* eslint-disable jsx-a11y/no-onchange */
return (
<SelectWrapper>
<label htmlFor={ id } disabled={ disabled }>
Expand All @@ -223,7 +222,6 @@ function BankSelector( { id, value, onChange, label, isError, errorMessage, disa
<ErrorMessage isError={ isError } errorMessage={ errorMessage } />
</SelectWrapper>
);
/* eslint-enable jsx-a11y/no-onchange */
}

function BankOption( { value, label } ) {
Expand Down
2 changes: 0 additions & 2 deletions client/my-sites/google-my-business/stats/chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ function getAggregation( props ) {
}

/* eslint-disable wpcalypso/jsx-classname-namespace */
/* eslint-disable jsx-a11y/no-onchange */

class GoogleMyBusinessStatsChart extends Component {
static propTypes = {
Expand Down Expand Up @@ -311,7 +310,6 @@ class GoogleMyBusinessStatsChart extends Component {
}
}
/* eslint-enable wpcalypso/jsx-classname-namespace */
/* eslint-enable jsx-a11y/no-onchange */

export default connect(
( state, ownProps ) => {
Expand Down
2 changes: 0 additions & 2 deletions client/my-sites/marketing/connections/mailchimp-settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ const MailchimpSettings = ( {
);
}

/* eslint-disable jsx-a11y/no-onchange */
return (
<div>
<QueryMailchimpLists siteId={ siteId } />
Expand Down Expand Up @@ -132,7 +131,6 @@ const MailchimpSettings = ( {
{ common }
</div>
);
/* eslint-enable jsx-a11y/no-onchange */
};

export const renderMailchimpLogo = () => (
Expand Down
2 changes: 0 additions & 2 deletions packages/composite-checkout/src/lib/payment-methods/ideal.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ function IdealFields() {
function BankSelector( { id, value, onChange, label, isError, errorMessage, disabled } ) {
const { __ } = useI18n();
const bankOptions = getBankOptions( __ );
/* eslint-disable jsx-a11y/no-onchange */
return (
<SelectWrapper>
<label htmlFor={ id } disabled={ disabled }>
Expand All @@ -137,7 +136,6 @@ function BankSelector( { id, value, onChange, label, isError, errorMessage, disa
<ErrorMessage isError={ isError } errorMessage={ errorMessage } />
</SelectWrapper>
);
/* eslint-enable jsx-a11y/no-onchange */
}

function BankOption( { value, label } ) {
Expand Down

0 comments on commit 805a247

Please sign in to comment.