eslint-plugin-jsx-a11y: The no-static-element-interactions rule breaks when used as part of the airbnb preset

Originally posted on airbnb/javascript.

Take this code (based on the no-static-element-interactions example):

import React from 'react';

const fn = () => {};

const element = <div
  onClick={fn}
  onKeyPress={fn}
  role="button"
  tabIndex="0">
  Save
</div>

The above code should pass the jsx-a11y/no-static-element-interactions rule, because the element has role="button", so it’s OK.

And it does pass that rule, when the rule is used on its own:

rules:
  jsx-a11y/no-static-element-interactions: error

But when the rule is used as part of the airbnb present, it fails, no matter what you put in the role attribute:

extends:
  - airbnb
Visible, non-interactive elements should not have mouse or
keyboard event listeners (jsx-a11y/no-static-element-interactions)

I don’t know what specifically causes the incompatibility in the airbnb preset, but hopefully someone with more knowledge will be able to find it.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 19
  • Comments: 24 (8 by maintainers)

Commits related to this issue

Most upvoted comments

@jessebeach there’s no reason to wait imo; we can major-bump as many times as we want if we have to, we won’t run out of numbers.

I’m never opposed to moving fast 😃 If folks prefer a little major-ver thrash vs a little major-ver quirk, then ya, let’s cut a release. @evcohen ?

@evcohen while i agree with that, there’s a countering tradeoff of unreleased things sitting in master so long that the people who want them get frustrated waiting for them to be released 😃

imo the best solution is making everything semver-minor for as long as possible, and waiting to merge any semver-major PRs until we’re ready to actually cut a major release immediately.

Alright I’ll create it, I forgot to add that I’m using airbnb also

@jessebeach ah just saw this, #220 is updated. mind taking a second look? i think its ready to go and we can include in v5.0 early this week.

ah happy to! just want to squeeze in one more breaking change for alt-text will post a PR ASAP.

On a more general note, I think the tradeoff of releasing majors too often is that people feel left behind and burdened to integrate at a high rate. I think trying to get as many breaking changes in the roadmap into a single major bump release is important