You found a bug! We've classified it as
a bug in our system.
We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
-
Ext User
[FIXED-598][3.x/2.x] isSpecialKey() does not include the DELETE key
The following mask was preventing the DELETE key from executing normally:
Code:
maskRe: /[a-zA-Z\'\- ]/
Overrode the isSpecialKey function to include DELETE.
Code:
Ext.EventObjectImpl.prototype.isSpecialKey = function() {
var k = this.keyCode;
k = Ext.isSafari ? (safariKeys[k] || k) : k;
return (this.type == 'keypress' && this.ctrlKey) ||
this.isNavKeyPress() ||
(k == this.BACKSPACE) || // Backspace
(k == this.DELETE) || // Delete -- Currently not implemented, can also change 45 to 46 below to include it as well.
(k >= 16 && k <= 20) || // Shift, Ctrl, Alt, Pause, Caps Lock
(k >= 44 && k <= 45); // Print Screen, Insert
};
Last edited by mystix; 11 Sep 2009 at 11:08 AM.
Reason: moved to 3.x Bugs from 2.x Bugs
-
checking for keycode 46 is definitely more efficient 
Code:
Ext.override(Ext.EventObjectImpl, function() {
var safariKeys = {
3 : 13, // enter
63234 : 37, // left
63235 : 39, // right
63232 : 38, // up
63233 : 40, // down
63276 : 33, // page up
63277 : 34, // page down
63272 : 46, // delete
63273 : 36, // home
63275 : 35 // end
};
return {
normalizeKey : function(k) {
return Ext.isSafari ? (safariKeys[k] || k) : k;
},
isSpecialKey : function(){
var k = this.normalizeKey(this.keyCode);
return (this.type == 'keypress' && this.ctrlKey) ||
this.isNavKeyPress() ||
(k == this.BACKSPACE) || // Backspace
(k >= 16 && k <= 20) || // Shift, Ctrl, Alt, Pause, Caps Lock
(k >= 44 && k <= 46); // Print Screen, Insert, Delete
}
}
}());
(look ma, no change in filesize!)
Last edited by mystix; 14 Sep 2009 at 8:06 AM.
Reason: edit
-
Ext User
Using the Ext.override() instead of overwriting the prototype.isSpecialKey function yields the following result on the key events in a masked field:
Code:
// this.normalizeKey is not a function
var k = this.normalizeKey(this.keyCode);\n
-
hmmm.. odd... try the updated override.
-
Ext User
Appears to function correctly.
Results, however, in the following "warnings" in Firefox (3.5.3)
Code:
The 'charCode' property of a keydown event should not be used. The value is meaningless.
The 'charCode' property of a keyup event should not be used. The value is meaningless.
-

Originally Posted by
kairinsama
Appears to function correctly.
Results, however, in the following "warnings" in Firefox (3.5.3)
Code:
The 'charCode' property of a keydown event should not be used. The value is meaningless.
The 'charCode' property of a keyup event should not be used. The value is meaningless.
you can ignore those for now. isSpecialKey() was designed to work on either the keydown / keypress / keyup event.
-
Ext JS Premium Member
Has this fix been committed for the next release?
-
it's definitely not in yet - i inspected the latest 3.x (and 2.x) codebase from SVN and it still says
Code:
// ... [ SNIP ] ...
(k >= 44 && k <= 45); // Print Screen, Insert
// ... [ SNIP ] ...
-
This is in 2.x and 3.2.x SVN. Due the nature of this change, it will not be in 3.1.x.