Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable jsx-a11y/no-onchange lint rule #50023

Merged
merged 2 commits into from Feb 14, 2021

Conversation

p-jackson
Copy link
Member

Changes proposed in this Pull Request

  • Disable the jsx-a11y/no-onchange lint rule
  • Remove instances where this had been explicitly disabled

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.

I believe the issue was that pressing the down key while moving through the options would immediately call onChange, which a React dev would probably use to set some state that could cause all sort of DOM changes, perhaps even making it impossible to make the selection you want.

The rule was removed from the jsx-a11y/recommended list in jsx-eslint/eslint-plugin-jsx-a11y#757 which will be shipped in a future release. I just wanted to get ahead of that release because I'm working on a PR that uses <select> now and discovered the warning wasn't doing anything useful.

Testing instructions

  • CI should pass, no lint warnings.

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.
@p-jackson p-jackson added [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. Accessibility (a11y) [Type] Janitorial labels Feb 12, 2021
@p-jackson p-jackson requested review from a team February 12, 2021 04:57
@p-jackson p-jackson requested a review from a team as a code owner February 12, 2021 04:57
@matticbot
Copy link
Contributor

@p-jackson p-jackson changed the title Update/disable jsx a11y no onchange lint rule Disable jsx-a11y/no-onchange lint rule Feb 12, 2021
@matticbot
Copy link
Contributor

This PR does not affect the size of JS and CSS bundles shipped to the user's browser.

Generated by performance advisor bot at iscalypsofastyet.com.

@scinos
Copy link
Contributor

scinos commented Feb 12, 2021

Thanks for going the extra mile and remove all /* eslint-disable jsx-a11y/no-onchange */ across our code base!

@p-jackson p-jackson merged commit 805a247 into trunk Feb 14, 2021
@p-jackson p-jackson deleted the update/disable-jsx-a11y-no-onchange-lint-rule branch February 14, 2021 22:45
@matticbot matticbot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Feb 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants