Hello,
To detect the simultaneous pressing of the Shift key and the Tab key in JavaScript, you can utilize the event.shiftKey property along with the event.keyCode (or event.which) property.
The event.shiftKey returns true if the shift key was pressed when the event was triggered, and false otherwise. For the Tab key, the keyCode is 9.
Here's a solution:
document.addEventListener('keydown', function(event) {
if (event.shiftKey && event.keyCode === 9) {
console.log('Shift + Tab was pressed together');
}
});
With the above code, whenever the Shift key and Tab key are pressed simultaneously, it will log the message "Shift + Tab was pressed together" to the console.
Your current method (event.keyCode === 16 && event.keyCode === 9) doesn't work because event.keyCode cannot have two values at the same time. Instead, you should use the event.shiftKey property to check if the Shift key was pressed and then check the keyCode for the Tab key.
Hope this helps!
Best,
RAD Manage