Giter Site home page Giter Site logo

Comments (6)

sir-marc avatar sir-marc commented on May 19, 2024 13

How do you handle onClick events on divs then?
For example a Modal. If i click on the Modal outside the popup itself, i want it to close. The Modalcontainer is a div for sure (or am i getting something wrong?). So how would i apply this use case then?

from eslint-plugin-jsx-a11y.

beefancohen avatar beefancohen commented on May 19, 2024 1

To be clear, I was talking about our recommended config 😛

from eslint-plugin-jsx-a11y.

ljharb avatar ljharb commented on May 19, 2024 1

aha, in that case it's up to you. It's certainly an opinionated rule, so a warning might make sense there.

from eslint-plugin-jsx-a11y.

ljharb avatar ljharb commented on May 19, 2024

This is a followup from https://github.com/evcohen/eslint-plugin-jsx-a11y/issues/77#issuecomment-241918479

from eslint-plugin-jsx-a11y.

beefancohen avatar beefancohen commented on May 19, 2024

Is this something we would want to error on or just warn with suggestion to use a natively-interactable DOM element? I know you've felt in the past that warning isn't entirely useful, but there are ways to make elements like <div> clickable as long as a proper role and a positive tabIndex are applied to the element.

from eslint-plugin-jsx-a11y.

ljharb avatar ljharb commented on May 19, 2024

How someone wishes to configure it would be up to them - and a helpful message is great - but I certainly wouldn't want anything to be configured as less than an error.

There are totally a myriad of workarounds to make elements like <div> clickable, but then you lose the semantic value of the tag name. Also, applying any tabIndex that is > 0 has a11y problems.

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.