I am writing an interactive application where user performs operations using keyboard. Most of the keystrokes are captured properly and executed, but on chrome when I press (ctrl + t) a new tab opens up, instead of calling my keypress event. Where as it works perfectly on Firefox and Internet Explorer, here is the sample code
<html>
<head>
<style>
#section {
width: 80%;
height: 500px;
background: grey;
margin: auto;
}
</style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script>
$(document).ready(function() {
$("#section").keydown(function(e) {
stopEvent(e);
console.log(e.key + " down");
});
function stopEvent (e) {
e.stopPropagation();
e.preventDefault();
}
});
</script>
</head>
<body>
<div id="section" tabindex="1">
<h2>Keyboard operations</h2>
</div>
</body>
</html>