View Full Version : [CLOSED] [4.0.7] Unable to stopEvent for keyboard shortcut in IE8

10 Nov 2011, 9:33 AM
I'm using KeyMap to intercept Alt+F keyboard events. In IE8, I'm unable to prevent the event from propagating and causing the browser's File menu to be shown.

Runnable test case: http://jsfiddle.net/clint_harris/MsANj/

// Map Alt+F
var map = new Ext.util.KeyMap(Ext.getBody(), {

key: Ext.EventObject.F,
alt: true,

// This should prevent the event from being propogated
defaultEventAction: "stopEvent",

handler: function(key, eventObj) {
alert('After dismissing this alert, IE should NOT expand the File drop-down menu but does.');

// Also, explicitly call the stopEvent() function

10 Nov 2011, 9:17 PM
There isn't a whole lot you can do, the browser will sometimes continue with certain key combinations anyway. Say for example, you tried to disable Alt+F4, that would be bad news!

Ext.onReady(function() {

document.attachEvent('onkeydown', function(e){
if (e.keyCode == 70 && e.altKey) {
e.returnValue = false;
}, false);



As you can see, the MSDN recommends using returnValue (which Ext does) for <= IE8.