Forum Discussion
Allow user to answer TAB or SHIFT+TAB?
I'm working on a training with an older system that is navigated with the keyboard. I'm trying to allow the user to practice by clicking the key or keys they need in the mainframe.
I've set up the triggers so that pressing the right trigger shows the answer and the next question. In theory.
But since Tab is the first question, it turns on the accessibility features and messes everything up. Shift+Tab doesn't do what it's supposed to do at all. They also need to use Pause/Break, but Storyline doesn't recognize that key so I created a workaround with a hotspot.
Before I blow this up and make it a drag and drop activity, is there a workaround to let them use the keyboard?
Looks like this JavaScript below will work for you. Also attaching file.
//tab key
document.addEventListener('keydown', function(event) {
if (event.keyCode === 9) {
event.preventDefault();
}
});
//F3 Key
document.addEventListener('keydown', function(event) {
if (event.key === 'F3' || event.keyCode === 114) {
event.preventDefault();
}
});
//Pause key
document.addEventListener('keydown', function(event) {
if (event.key === 'Pause') {
var player = GetPlayer();
player.SetVar("Pause", 1);
}
});
1 Reply
- NickBaca-9980a0Community Member
Looks like this JavaScript below will work for you. Also attaching file.
//tab key
document.addEventListener('keydown', function(event) {
if (event.keyCode === 9) {
event.preventDefault();
}
});
//F3 Key
document.addEventListener('keydown', function(event) {
if (event.key === 'F3' || event.keyCode === 114) {
event.preventDefault();
}
});
//Pause key
document.addEventListener('keydown', function(event) {
if (event.key === 'Pause') {
var player = GetPlayer();
player.SetVar("Pause", 1);
}
});