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.

How to select the first option in the carriage return event?

See original GitHub issue

I hope that <AutoComplete/> can correctly trigger the Enter event regardless of whether the option is selected or not

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
StringKecommented, Aug 13, 2021

You should do something like this:

onKeyDown={ e => {
          const { key } = e;
          if (key === "Enter") {
            
            //Whatever you want to do.

            e.preventDefault();
            
            // If you want to prevent the default actions done by the package, such as selecting an option.
            e.stopPropagation()

}}

I understand, thank you

0reactions
StringKecommented, Aug 13, 2021

would an onEnterKeydown event prop be okay?

Does react or charka have this event?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Line Break in HTML Select Option? - Stack Overflow
Hi @user1609391, you have to assign your element as a select2 element and define the templateResult and templateSelection . You have it on...
Read more >
how to differentiate between enter key pressed on option and ...
How can i differentiate when a user selects one of the option by pressing enter and a user pressing enter key in input...
Read more >
Encoding and line break characters - Visual Studio (Windows)
Choose the Commands tab, select the Menu bar radio button and from the corresponding drop-down list choose File. Choose the Add Command button....
Read more >
Start new line in Excel cell - 3 ways to add carriage return
On Windows, hold Alt while pressing the Enter key. In Excel for Mac, hold Control and Option while pressing the Return key. Press...
Read more >
type - Cypress Documentation
The text to be typed into the DOM element. ... {enter}, Types the Enter key ... For 'selecting' an option, just type it...
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