Change ListBox shortcut keys

Hi,


Is there a possibility to change existing shortcut keys in the ListBox component?


https://ej2.syncfusion.com/documentation/list-box/accessibility/#keyboard-interaction


In the documentation there is already a definition of these shortcuts, but I would need to change them to other combinations.


Is there this possibility?


1 Reply

SP Sangeetha Priya Murugan Syncfusion Team March 25, 2022 12:26 PM UTC

Hi Tech Shop, 

 
Your requirement can be achievable in our List box by binding the keyDown event in List box created event as like as below. 

 
  
public oncreated(): void { 
    this.listObj1.element.addEventListener( 
      'keydown', 
      (e) => { 
        if (e.keyCode == 65 || e.keyCode == 97) { 
          // prevent ctrl+ a action 
          e.stopImmediatePropagation(); 
          // do your own action here 
        } 
      }, 
      true 
    ); 
  } 
  
    <ejs-listbox 
      #listbox1 
      [dataSource]="data" 
      (created)="oncreated($event)" 
    ></ejs-listbox> 
  

 
For your convenience, we have prepared the sample based on our suggestion.  In this we have prevented the Ctrl + A action in created event and do your own customization in that event. Please find the link below. 

 

 
Could you please check the attached sample and get back to us, if you need any further assistance on this. 

 
Regards, 
Sangeetha M 


Loader.
Up arrow icon