Skip to content

[no-static-element-interactions] why the difference between the recommended configuration and default value for handlers #1076

@G-Rath

Description

@G-Rath

I've been helping out on eslint-plugin-vuejs-accessibility which understandable mirrors a lot of this plugin, and there are a couple of issues open (vue-a11y/eslint-plugin-vuejs-accessibility#980, vue-a11y/eslint-plugin-vuejs-accessibility#1381) about the default handler configurations for the no-static-element-interactions rule.

Currently, the two interaction based rules are using an interactiveHandlers.json which contains:

[
  "click",
  "contextmenu",
  "dblclick",
  "doubleclick",
  "drag",
  "dragend",
  "dragenter",
  "dragexit",
  "dragleave",
  "dragover",
  "dragstart",
  "drop",
  "keydown",
  "keypress",
  "keyup",
  "mousedown",
  "mouseenter",
  "mouseleave",
  "mousemove",
  "mouseout",
  "mouseover",
  "mouseup"
]

This looks to match the default interactive handlers for the jsx rule, which I assume is what it was based on:

const defaultInteractiveProps = [].concat(
eventHandlersByType.focus,
eventHandlersByType.keyboard,
eventHandlersByType.mouse,
);

However, the documentation and recommended config for this plugin is reconfiguring the rule with a smaller set of handlers:

'jsx-a11y/no-static-element-interactions': [
'error',
{
allowExpressionValues: true,
handlers: [
'onClick',
'onMouseDown',
'onMouseUp',
'onKeyPress',
'onKeyDown',
'onKeyUp',
],
},
],

Is there a particular reason for this difference, or just an oversight?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions