This is a migrated thread and some comments may be shown as answers.

Select on mouseclick and Enter only

1 Answer 514 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Erik
Top achievements
Rank 1
Erik asked on 11 Nov 2015, 09:21 AM

Hi!

I have a problem with combobox keyboard navigation, since up and down arrow keys trigger both the change and select event of the combobox and the desired functionality is for that to happen only if the selection is made by left mouse button down or Enter key. I've tried catching the keydown event in both the change and select events of the combobox but the keycode values aren't part of the values passed by the event.

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 13 Nov 2015, 09:59 AM
Hello Erik,

The ComboBox, like DropDownList widget, mimics HTML Select behavior, and namely the widget should trigger change when new value is selected while popup is closed. I am afraid that there is no easy way to prevent this behavior. The only solution I can think of is to prevent selection (call e.preventDefault in select event). You can find which key has been pressed wiring the keydown event outside of the widget:
combo.kendoComboBox({
...
select: function(e) {
  if (/*condition*/) {
      e.preventDefault();
  }
}
...
});
combo.data("kendoComboBox").input.on("keydown", function(e) {
  //cache the e.keyCode here
});

Regards,
Georgi Krustev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
ComboBox
Asked by
Erik
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or