Prevent the item selected in DropDown changing using the UpArrow and DownArrow buttons when Popup is closed

Hi,

How can I prevent the selected item from being changed by the UpArrow and DownArrow keyboard buttons when we have focused on DropDown and Popup is closed?

1 Reply 1 reply marked as answer

PM Ponmani Murugaiyan Syncfusion Team February 8, 2021 08:52 AM UTC

Hi Arman, 

Greetings from Syncfusion support. 

We achieved your reported requirement by preventing the keys (UpArrow, DownArrow, Home, End) when the popup is closed state. Please find the code snippet and sample below for reference. 

onSelected(args) { 
    if ((args.e.keyCode == 38 || args.e.keyCode == 40 || args.e.keyCode == 35 || args.e.keyCode == 36) && !this.isPopupOpen) { 
        args.cancel = true; 
    } 
} 



Please get back us if you need further assistance. 

Regards, 
Ponmani M 


Marked as answer
Loader.
Up arrow icon