Skip to content

Commit

Permalink
feat: deprecate no-onchange rule (#854)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lehoczky authored Jul 24, 2023
1 parent b809098 commit 3fe0f5b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/rules/no-onchange.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# no-onchange

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

## 🔧 Options
Expand Down
1 change: 0 additions & 1 deletion src/configs/recommended.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ const recommended: Linter.BaseConfig = {
"vuejs-accessibility/no-access-key": "error",
"vuejs-accessibility/no-autofocus": "error",
"vuejs-accessibility/no-distracting-elements": "error",
"vuejs-accessibility/no-onchange": "error",
"vuejs-accessibility/no-redundant-roles": "error",
"vuejs-accessibility/no-static-element-interactions": "error",
"vuejs-accessibility/role-has-required-aria-props": "error",
Expand Down
1 change: 1 addition & 0 deletions src/rules/no-onchange.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
const rule: Rule.RuleModule = {
meta: {
type: "problem",
deprecated: true,
docs: {
url: makeDocsURL("no-onchange")
},
Expand Down

0 comments on commit 3fe0f5b

Please sign in to comment.