Skip to content

Do we need a no-onchange rule? #97

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

Closed
yamanoku opened this issue Dec 13, 2020 · 3 comments · Fixed by #854
Closed

Do we need a no-onchange rule? #97

yamanoku opened this issue Dec 13, 2020 · 3 comments · Fixed by #854
Labels
good first issue Good for newcomers

Comments

@yamanoku
Copy link
Member

yamanoku commented Dec 13, 2020

Hello. ✋

I was recently trying out Svelte tutorial and encountered the following error.

A11y: on:blur must be used instead of on:change, unless absolutely necessary and it causes no negative consequences for keyboard only or screen reader users.

It's one where you have to use on:blur if you are using only on:change.

I just remembered that there is a no-onchange rule in eslint-plugin-vuejs-accessibility.

https://github.com/vue-a11y/eslint-plugin-vuejs-accessibility/blob/master/docs/no-onchange.md

By the way, I also looked at the eslint-plugin-jsx-a11y rules, but they are now deprecated.
Please check the details below.

jsx-eslint/eslint-plugin-jsx-a11y#398

As for React.js, it seems that using the onBlur event will cause a warning on the console.


Is it really a problem to just write onChange? I've been looking into it.
In the WebAim discussion, the following is a "mostly" OK response.
https://webaim.org/discussion/mail_thread?thread=8036#post1

In most cases this is actually ok.

I would say, rough estimate, that 80% of onchange events I have seen are ok, 20% are not.

Of the articles referenced in eslint-plugin-vuejs-accessibility, one seems to have an invalid link, and the other link is from around 2004.


It is important to have accessibility measures as a rule, but I think that this rule needs to be updated.

I have two suggestions for the no-onchange rule.

  • Treat the rule itself as deprecated (as in jsx).
  • Make this rule a warning only, rather than an error (is this possible?)

Of course, this is just my opinion from what I've seen, and I'd like to hear opinions from various people. :-)

kommunarr added a commit to kommunarr/FreeTube that referenced this issue Aug 14, 2021
@fpigeonjr
Copy link

fpigeonjr commented Mar 23, 2022

From what I am reading here it is something that is deprecated and meant to target older-browsers.
https://open-wc.org/docs/linting/eslint-plugin-lit-a11y/rules/no-invalid-change-handler/

Probably going to turn off in my project by

// .eslintrc
 "vuejs-accessibility/no-onchange": ["off"],

@vhoyer
Copy link
Collaborator

vhoyer commented Oct 4, 2022

I would say that if someone get this issue to fix, it would be removing it from the recommended and add a note about it being deprecated on the documentation of the rule? probably best to include some links about the decision about it's deprecation, at least this issues link.

@vhoyer vhoyer added the good first issue Good for newcomers label Oct 4, 2022
@vhoyer
Copy link
Collaborator

vhoyer commented Oct 4, 2022

I see that we didn't really have much of a discussion about this, but the points presented are very compelling in my opinion, that's why I'm saying this, but if someone has anything against it, we'd like to hear from you. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants