私はjavascriptを使用してキーボードインターフェイスを設計しており、Shift+Rightkeyやctrl+tabなどのキーストロークの組み合わせを定義したいと考えています。しかし、ここに見られるように、javascriptをいじくり回した後、すべてのキーイベントが中断していることに気づきました。提供されている例では、右キーを押しながらシフトキーを押すと、右キーの機能が中断されます。
v = 1; /*v is the variable of velocity.*/
window.addEventListener("keydown", function(event)
{
if(event.keyCode == 39) /*39 is the keycode of rightarrowkey.*/
{
//moves an element by the velocity.
var keystroke = document.getElementById("keystroke");
keystroke.style.left = parseInt(keystroke.style.left.slice(0,-2))+v+"px";
}
if(event.keyCode == 16) /*16 is the keycode of shift.*/
{
//increases the velocity of the element by four.
document.getElementById("keystroke").style.borderColor = "red";
v = 4;
}
}, false); //but hitting the shiftkey while hitting the rightkey interrupts..!
また、オブジェクトを介してすべてのキーストロークを記録し、次に、ここに示すように、定義されたキーストロークに対して指定された間隔で繰り返されることを実験しました。しかし、キーボードを処理するこのシステムは、個々のキーストロークを保持しません。キーを押すのが速すぎると、考慮されない場合があります。または、キーを長く保持しすぎると、考慮されない場合があります。