question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

click-events-have-key-events applies to native buttons and links

See original GitHub issue

Native elements like <button> or <a> (also counting <nuxt-link> / <router-link> into it) don’t need additional handlers beside a @click or @click.native listener.

Adding another handler for keydown events will actually lead to bugs and double execution of the function.

Maybe we should add a whitelist to that rule

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:7
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
juliandreascommented, Nov 19, 2019

Would be cool if this could get fixed.

5reactions
rafaelmaiachcommented, Jun 21, 2019

@maranran I’m having this problem even with button elements:

 <button class="button" @click="save">
     {{ buttonText }}
 </button>

Eslint throws: Visible, non-interactive elements with click handlers must have at least one keyboard listener.

I’m using the extends recommended

Read more comments on GitHub >

github_iconTop Results From Across the Web

Element: click event - Web APIs | MDN
An element receives a click event when a pointing device button (such as a mouse's primary mouse button) is both pressed and released...
Read more >
React onClick event handlers: A complete guide
Learn the basics of React's onClick event handler, including event listening, onClick buttons, synthetic events, custom events, and more.
Read more >
Handling Events - React
React events are named using camelCase, rather than lowercase. With JSX you pass a function ... <button onClick={activateLasers}> Activate Lasers </button>.
Read more >
React onClick Event Handling (With Examples) - Upmostly
Whenever you need to perform an action after clicking a button, link, or pretty much any element, you'll use the onClick event handler....
Read more >
Buttons - Android Developers
To define the click event handler for a button, ... The method you declare in the android:onClick attribute must have a signature exactly...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found