Skip to content

Button prevent Enter #5869

Answered by adidahiya
maxime700 asked this question in Q&A
Discussion options

You must be logged in to vote

A click and then an Enter keypress seems like an interaction that should trigger the button handler twice.

But if you want to only handle the click event in this.onAdd, then you can inspect the event argument in the onClick callback. If it's a keypress rather than a click event, ignore it in your handler.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by adidahiya
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
2 participants
Converted from issue

This discussion was converted from issue #5479 on January 24, 2023 15:01.