GithubHelp home page GithubHelp logo

Comments (7)

backwardok avatar backwardok commented on May 18, 2024

Btw I think also inputs work as well - essentially form elements and links should have that behavior default. It's the elements that you're adding non default behavior to where you have to also add in keyboard listeners

from eslint-plugin-jsx-a11y.

lencioni avatar lencioni commented on May 18, 2024

Oh right, of course.

from eslint-plugin-jsx-a11y.

ljharb avatar ljharb commented on May 18, 2024

For purposes of semantic markup, why would we want to encourage adding onClick to a non-natively-clickable thing anyways?

from eslint-plugin-jsx-a11y.

lencioni avatar lencioni commented on May 18, 2024

Yeah, it should likely suggest using a button or link first, or alternatively adding the keyboard stuff.

from eslint-plugin-jsx-a11y.

ljharb avatar ljharb commented on May 18, 2024

Do we have another rule that can actively prohibit adding interaction behavior to non-natively-interactable DOM elements?

from eslint-plugin-jsx-a11y.

beefancohen avatar beefancohen commented on May 18, 2024

Do we have another rule that can actively prohibit adding interaction behavior to non-natively-interactable DOM elements?

No but we have onclick-has-role, which requires adding the role prop to non-natively-interactable DOM elements with click handlers.


just to clarify, this seems like we are taking the logic for determining non-interactive DOM elements from onclick-has-role and enforcing that those elements with onClick handlers have accompanying onKeyDown, onKeyUp, or onKeyPress props.

rule: click-events-have-key-events (similar to mouse-events-have-key-events)

from eslint-plugin-jsx-a11y.

ljharb avatar ljharb commented on May 18, 2024

I filed #78 for https://github.com/evcohen/eslint-plugin-jsx-a11y/issues/77#issuecomment-241918479

from eslint-plugin-jsx-a11y.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.