Skip to content

Commit

Permalink
[patch] no-onchange: Remove rule from recommended/strict configs, a…
Browse files Browse the repository at this point in the history
…nd deprecate

See #398 (comment)
  • Loading branch information
karlhorky authored and ljharb committed Nov 17, 2020
1 parent 0706457 commit 20b48a4
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 3 additions & 1 deletion docs/rules/no-onchange.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# no-onchange
# [Deprecated] no-onchange

⚠️ **Deprecated:** This rule is based on reports of behavior of [old browsers (eg. IE 10 and below)](https://www.quirksmode.org/dom/events/change.html#t05). In the meantime, this behavior has been corrected, both in newer versions of browsers as well as [in the DOM spec](https://bugzilla.mozilla.org/show_bug.cgi?id=969068#c2).

Enforce usage of `onBlur` over/in parallel with `onChange` on select menu elements for accessibility. `onBlur` **should** be used instead of `onChange`, unless absolutely necessary and it causes no negative consequences for keyboard only or screen reader users. `onBlur` is a more declarative action by the user: for instance in a dropdown, using the arrow keys to toggle between options will trigger the `onChange` event in some browsers. Regardless, when a change of context results from an `onBlur` event or an `onChange` event, the user should be notified of the change unless it occurs below the currently focused element.

Expand Down
2 changes: 0 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@ module.exports = {
allowExpressionValues: true,
},
],
'jsx-a11y/no-onchange': 'error',
'jsx-a11y/no-redundant-roles': 'error',
'jsx-a11y/no-static-element-interactions': [
'error',
Expand Down Expand Up @@ -283,7 +282,6 @@ module.exports = {
],
'jsx-a11y/no-noninteractive-element-to-interactive-role': 'error',
'jsx-a11y/no-noninteractive-tabindex': 'error',
'jsx-a11y/no-onchange': 'error',
'jsx-a11y/no-redundant-roles': 'error',
'jsx-a11y/no-static-element-interactions': 'error',
'jsx-a11y/role-has-required-aria-props': 'error',
Expand Down
1 change: 1 addition & 0 deletions src/rules/no-onchange.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = {
docs: {
url: 'https://github.com/evcohen/eslint-plugin-jsx-a11y/tree/master/docs/rules/no-onchange.md',
},
deprecated: true,
schema: [schema],
},

Expand Down

0 comments on commit 20b48a4

Please sign in to comment.