Skip to content

Instantly share code, notes, and snippets.

@aadrian
Created April 5, 2012 10:54
Show Gist options
  • Save aadrian/2309933 to your computer and use it in GitHub Desktop.
Save aadrian/2309933 to your computer and use it in GitHub Desktop.
keyboard.js bug with AlgGR
<!doctype html>
<html>
<head>
<title>KeyboardJS Bug 1</title>
<script src="keyboard.0.2.2.js"></script>
<script type="text/javascript">
// this should be a different function from Alt GR
KeyboardJS.bind.key('alt + e', function(event, keysPressedArray, keyComboString){
console.log('event object', event);
console.log('keys pressed', keysPressedArray);
console.log('combo pressed', keyComboString);
//block event bubble
return false;
}, function(event, keysPressedArray, keyComboString){
//block event bubble
return false;
});
function showActive(){
var active = KeyboardJS.activeKeys();
var activeText = document.createTextNode(active.join());
document.body.appendChild(activeText);
}
</script>
</head>
<body>
<h1>Keyboard JS Bug 1</h1>
<!-- Markup goes here... -->
<form>
<input name="fld1" type="text"/>
</form>
<button onclick="showActive();">Show Active Events</button>
<hr/>
<p>
Type AltGr + e with the focus in the input field -> it should display the euro symbol.
</p>
<hr/>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment