Add onPressEnter for select component
See original GitHub issueWhat problem does this feature solve?
When we use Select with ‘combobox’ mode, we usually do some thing when user press Enter, like do a search action. Hope to support this feature.
What does the proposed API look like?
<Select onPressEnter={this.handlePressEnter}>{options}</Select>
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:17 (16 by maintainers)
Top Results From Across the Web
to call onChange event after pressing Enter key - Stack Overflow
According to React Doc, you could listen to keyboard events, like onKeyPress or onKeyUp , not onChange . var Input = React.
Read more >How to Use the Enter Key Event Handler on a React-Bootstrap ...
React-Bootstrap is a popular library of easy-to-use Bootstrap components for React apps. In this guide, you'll learn about keyboard events ...
Read more >Input - Ant Design
A basic widget for getting the user input is a text field. Keyboard and mouse can be used for providing or changing data....
Read more >How to get the enter key in ReactJS ? - GeeksforGeeks
In the input, we have added an on Keypress function which will get activated whenever the user clicks and types something in the...
Read more >How To Trigger Button Click on Enter - W3Schools
Cancel the default action, if needed event.preventDefault(); // Trigger the button element with a click document.getElementById("myBtn").click(); }
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
There are two workarounds for now.
input[onKeyDown]
: https://codepen.io/afc163/pen/VWRqVo?editors=001onKeyDown
in wrapper: https://codepen.io/afc163/pen/NgJeep?editors=001 like @yesmeck said.And we still need to fix Select[combobox][onKeyDown].
I think it’s ok to fire on every
keyDown
event and in all modes. People who wantEnter
event just checke.keyCode
.