Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
edwin
Master II
Master II

how do you capture keyboard events in extension?

Hi, ive seen articles on accessibility for qlik sense itself.  however i cant find any accessibility topics for extensions.  how do you capture keyboard events in your extension?

thanks,

edwin

6 Replies
dannyy81
Contributor III
Contributor III

you can use jQuery :

for example - capture enter key 

$('#someTextBox').keypress(function(event){
var keycode = (event.keyCode ? event.keyCode : event.which);
if(keycode == '13'){
alert('You pressed a "enter" key in textbox');
}
});

 

edwin
Master II
Master II
Author

hi @dannyy81 thanks for the response

ive seen this when the user is in an HTML object and presses a key

for accessibility, the whole extension is selected and the user presses a key.  to simulate this, press tab when you are in Qlik Sense until the first visualization object is selected, press press arrow keys to navigate to your extension.  then press ENTER.  thats the key i want to capture.

so its not really a user pressing a key when in a text box.

thanks for your time though.

edwin
Master II
Master II
Author

this will give you an idea:

https://www.qlik.com/us/trust/accessibility

 

edwin
Master II
Master II
Author

there is a toggleDataView method in the capability API but all of the examples are for Mashups.  can that be used for extensions?  how?

thanks,

edwin

chrismorris
Contributor
Contributor


@dannyy81 wrote:

you can use jQuery :

for example - capture enter key 

$('#someTextBox').keypress(function(event){
var keycode = (event.keyCode ? event.keyCode : event.which);
if(keycode == '13'){
alert('You pressed a "enter" key in textbox');
}
});

 


I am try to make a space bar clicker that counts the number of time you press the spacebar key.  Your code uses keycode==13 for Enter key. I am not sure what keycode to use for spacebar button. Can you please help with this?

dannyy81
Contributor III
Contributor III

try 32