Skip to content

Commit 20b48a4

Browse files
karlhorkyljharb
authored andcommittedNov 17, 2020
[patch] no-onchange: Remove rule from recommended/strict configs, and deprecate
See #398 (comment)
1 parent 0706457 commit 20b48a4

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed
 

‎docs/rules/no-onchange.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
# no-onchange
1+
# [Deprecated] no-onchange
2+
3+
⚠️ **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).
24

35
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.
46

‎src/index.js

-2
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ module.exports = {
175175
allowExpressionValues: true,
176176
},
177177
],
178-
'jsx-a11y/no-onchange': 'error',
179178
'jsx-a11y/no-redundant-roles': 'error',
180179
'jsx-a11y/no-static-element-interactions': [
181180
'error',
@@ -283,7 +282,6 @@ module.exports = {
283282
],
284283
'jsx-a11y/no-noninteractive-element-to-interactive-role': 'error',
285284
'jsx-a11y/no-noninteractive-tabindex': 'error',
286-
'jsx-a11y/no-onchange': 'error',
287285
'jsx-a11y/no-redundant-roles': 'error',
288286
'jsx-a11y/no-static-element-interactions': 'error',
289287
'jsx-a11y/role-has-required-aria-props': 'error',

‎src/rules/no-onchange.js

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ module.exports = {
2424
docs: {
2525
url: 'https://github.com/evcohen/eslint-plugin-jsx-a11y/tree/master/docs/rules/no-onchange.md',
2626
},
27+
deprecated: true,
2728
schema: [schema],
2829
},
2930

0 commit comments

Comments
 (0)
Please sign in to comment.