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

tabbing out of combobox with suggested fix for filter - causes first item in list to be selected but not indicated

1 Answer 75 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 07 Jan 2021, 05:28 PM

While using the filter fix suggested in the documentation here , it causes an issue when tabbing into and then immediately out of a combobox.  

If you tab into a combobox with the fix in place and then tab out without entering any other text, the tab out causes the suggested fix to fire sender.showDropDown().  At this point you've already moved to the next field, so I think what is happening is the dropdown gets shown then hid and in that process it then selects the first item in the list as the SelectedItem, but it doesn't change the actually item displayed in the combobox.  So this results in a different item being reported as selected compared to what the user sees.

Changing the suggested fix to not fire for the tab key fixes the problem.  Suggested fix should be:

<telerik:RadComboBox RenderMode="Lightweight"
     ID="rco_1"
     Filter="Contains"
     AllowCustomText="false"
     OnClientKeyPressing="HandleComboBoxKeyPress"
     runat="server"   >                               
</telerik:RadComboBox>

 

<script type="text/javascript">
  function HandleComboBoxKeyPress(sender, e) {
    if (!sender.get_dropDownVisible()) {
      if (e.get_domEvent().keyCode != 9) {
        // not tab out, show the dropdown to filter
        sender.showDropDown();
      }                       
    }
  }
</script>

1 Answer, 1 is accepted

Sort by
0
Vessy
Telerik team
answered on 12 Jan 2021, 01:35 PM

Hi Robert,

Thanks a lot for sharing the found fix. I have just applied your suggestion to our documentation, and it will be live without next build:

https://github.com/telerik/ajax-docs/blob/master/controls/combobox/troubleshooting/filter-does-not-work-when-you-tab-to-the-combobox.md

Regards,
Vessy
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/.

Tags
ComboBox
Asked by
Robert
Top achievements
Rank 1
Answers by
Vessy
Telerik team
Share this question
or