-
11 Sep 2009 7:13 AM #1
[FIXED-598][3.x/2.x] isSpecialKey() does not include the DELETE key
[FIXED-598][3.x/2.x] isSpecialKey() does not include the DELETE key
The following mask was preventing the DELETE key from executing normally:
Overrode the isSpecialKey function to include DELETE.Code:maskRe: /[a-zA-Z\'\- ]/
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
-
11 Sep 2009 11:10 AM #2
checking for keycode 46 is definitely more efficient

(look ma, no change in filesize!)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 } } }());Last edited by mystix; 14 Sep 2009 at 8:06 AM. Reason: edit
Sencha Docs / Ext 3.x - ( Docs | Examples )
Learning Center / Saki's Examples (for 2.x) / HOWTO - ( Report Bugs | Post Proper Code )
-
14 Sep 2009 7:23 AM #3
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
-
14 Sep 2009 8:06 AM #4
hmmm.. odd... try the updated override.
Sencha Docs / Ext 3.x - ( Docs | Examples )
Learning Center / Saki's Examples (for 2.x) / HOWTO - ( Report Bugs | Post Proper Code )
-
14 Sep 2009 8:21 AM #5
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.
-
14 Sep 2009 8:23 AM #6
Sencha Docs / Ext 3.x - ( Docs | Examples )
Learning Center / Saki's Examples (for 2.x) / HOWTO - ( Report Bugs | Post Proper Code )
-
18 Feb 2010 6:19 AM #7
Has this fix been committed for the next release?
-
18 Feb 2010 7:41 AM #8
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 ] ...
Sencha Docs / Ext 3.x - ( Docs | Examples )
Learning Center / Saki's Examples (for 2.x) / HOWTO - ( Report Bugs | Post Proper Code )
-
18 Feb 2010 10:31 AM #9Sencha - Sencha Touch Dev Team
- Join Date
- Mar 2007
- Location
- Redwood City, California
- Posts
- 3,651
- Vote Rating
- 14
This is in 2.x and 3.2.x SVN. Due the nature of this change, it will not be in 3.1.x.
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.


Reply With Quote