Is it possible to disable keyboard-navigation, specifically "Enter"?

1 Answer 80 Views
AutoComplete
Wreeecks
Top achievements
Rank 2
Iron
Iron
Iron
Wreeecks asked on 12 Jan 2022, 10:56 PM

Is it possible to disable a certain keyboard-navigation event?  

I don't want the user to automatically select the first suggestion when pressing enter.

I was looking at the Autocomplete src code and found `onNavigate(state: AutoCompleteInternalState, keyCode: number): void;`. How do i use this?

Is there a way to disable it or maybe a work around to override the "enter" event?

1 Answer, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 13 Jan 2022, 08:31 AM

Hello,

Currently, the keyboard navigation will always be on.

If you wish we can log a feature to provide an option to disable it:

https://feedback.telerik.com/kendo-react-ui

I can also directly convert this to an official public feature request.

Please have in mind that this feature will disable to entire keyboard navigation, not on a specific integration.

What we can suggest is to use the onChange event and if the change is after Enter to not update the value. It will still close the AutoComplete, but it will not select the value:

https://stackblitz.com/edit/react-upo8ka?file=app/main.jsx

 

Regards,
Stefan
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Wreeecks
Top achievements
Rank 2
Iron
Iron
Iron
commented on 13 Jan 2022, 10:32 PM

Thanks, Stefan! I think this will do. 

My case is one of a kind, maybe autocomplete is not the right component to use. 

Tags
AutoComplete
Asked by
Wreeecks
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Stefan
Telerik team
Share this question
or