-
13 Sep 2012 9:55 AM #1
Backspace in alert dialog
Backspace in alert dialog
Noticed that if you press backspace while a alert dialog is open, the browser goes back to the previous page!! At least in Chrome.
Try it in the demo:
http://dev.sencha.com/deploy/ext-4.1...x/msg-box.html
Click on the alert, then press backspace on your keyboard.
Is there a way to stop this? ExtJS 4.1.1, Chrome 21.
-
14 Sep 2012 6:46 AM #2
I do not see this behavior. Tested with 4.1.1, 4.1.2.
No action on backspace key.
Scott
-
14 Sep 2012 6:52 AM #3
Did you use that link? Because the forum opens it in a different window, there is nowhere to go back to. Try:
Open a new browser
go to some address
Paste in the hyperlink I provided
Click 'Alert'
Press backspace.
I see it on Chrome 21, on 2 PC's. Windows 7
-
14 Sep 2012 7:00 AM #4
OK.. it happens in Windows and Mac, but not Linux. Just change your OS

I will have a look.
Thanks.
-
14 Sep 2012 7:03 AM #5
Ah glad it's reproducible. It's potentially quiet serious, loosing unsaved forms etc..!
Thanks
-
19 Sep 2012 2:54 PM #6
Thanks for the report! I have opened a bug in our bug tracker.
Scott
-
7 Feb 2013 8:08 AM #7
This is a very serious bug. With extjs 3.x.x, I use following code to prevent this.
I couldn't find any way to prevent this with extjs 4.x.x since Ext.getCmp( t.id ) is not working with 4.x.x any more. I don't think we can release any product without this bug fixed.
PHP Code:
Ext.getBody().on('keydown', this._setBackSpace, this);
_setBackSpace: function(e, t, o ) {
if(e.getKey() === e.BACKSPACE) {
var c = Ext.getCmp( t.id );
var ckBackspace = true;
if( c && c.xtype ) {
if( c.xtype == 'textfield' || c.xtype == 'numberfield' || c.xtype == 'textarea' || c.xtype == 'htmleditor' ||
( c.xtype == 'combo' && c.editable == true ) )
if( c.readOnly != true && c.disabled != true ) ckBackspace = false;
}
if( ckBackspace ) {
e.stopEvent();
return false;
}
}
},
-
7 Feb 2013 8:18 AM #8
Sencha, any chance of a work-around? It is potentially serious, and can result in data loss for my clients
-
7 Feb 2013 9:50 AM #9
Spent a bit time, below is the code to prevent the chrome backspace problem. The work-around may not be the best, but it works for me.
I have reported this bug for extjs 3.x.x and Sencha never fix it. http://www.sencha.com/forum/showthre...is-not-working
And I tried to fix this same bug for extjs 4.0.x more than a year ago, and just spent lots of time, did not get any valuable response. Very disappoint about the supports.
http://www.sencha.com/forum/showthre...is-not-working
PHP Code:
Ext.onReady( function() {
Ext.getBody().on('keydown', this._setBackSpace, this);
//....... // your owner code here
});
_setBackSpace: function(e, t, o ) {
if(e.getKey() === e.BACKSPACE) {
var ckBackspace = true, c;
if( t.tagName == 'INPUT' ) {
Ext.ComponentManager.each(function(key, item) {
if( item.inputId && item.inputId == t.id ) c = item;
});
if( c && c.xtype && c.readOnly != true && c.disabled != true) {
if( c.xtype == 'textfield' || ( c.xtype == 'combo' && c.editable == true ) || c.xtype == 'numberfield' ||
c.xtype == 'textarea' || c.xtype == 'htmleditor' ) ckBackspace = false;
}
}
if( ckBackspace ) {
e.stopEvent();
return false;
}
}
}
-
7 Feb 2013 10:54 AM #10
You found a bug! We've classified it as
EXTJSIV-7285
.
We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.


Reply With Quote
