Disable submission button on enter key

I’m currently building a feature in my app that suggests other values that users have entered as the user types their value into the SearchBox component (the functionality is similar to that of LinkedIn’s input suggestions).


This way a user can use a value others have used before or enter their own if it hasn’t been used yet.

Ideally when the user hits the enter key while typing into this field it should autocomplete whatever value is selected (using the arrow keys or the top value if they haven’t used the arrow keys). Instead when a user hits they enter key it triggers the + button to the right of the input and submits the partially typed value the user was working on. Is there a way to disable the button from submitting the field on an enter key without disabling the button?

That’s an interesting one. In your example, if you type “Stu,” use arrow keys to make sure “Stuff6” is selected, then you hit enter, what gets added to your list?

Strangly enough it selects “Stuff6” and the enter button doesn’t trigger the + button - even after it finishes the autocomplete.

Hmm, not sure I quite follow. Can you share a link or recreate it in one of the forum apps?

No problem. I’m travelling right now and will post asap.

This topic was automatically closed after 70 days. New replies are no longer allowed.