-
8 May 2012 9:53 AM #1
[4.1.0] Window is not closed on Esc
[4.1.0] Window is not closed on Esc
Hi,
Apologize if it has been reported before, I was unable to find.
Also I assume it is a known bug. But I decided to report.
REQUIRED INFORMATION
Ext version tested:- Ext 4.1.0
- Any
- Any
- A Window is not closed on Esc according to
Steps to reproduce the problem:- Focus any Window and press Esc.
- The window is closed.
- The Window is not closed.
Please see the steps to reproduce.
HELPFUL INFORMATION
Debugging already done:- The problem lies within the Window afterRender function. Its keyMap is always disabled.
Possible fix:Code:afterRender: function() { var me = this, keyMap; me.callParent(); // Initialize if (me.maximized) { me.maximized = false; me.maximize(); } if (me.closable) { keyMap = me.getKeyMap(); keyMap.on(27, me.onEsc, me); //if (hidden) { ? would be consistent w/before/afterShow... keyMap.disable(); //} } }- Workaround. I just enable the keyMap for now. Code:
win.getKeyMap().enable();
-
15 Jun 2012 1:49 AM #2
Dear ExtJS team,
Could someone have a chance to look at the problem?
-
15 Jun 2012 6:03 AM #3
Can you provide a test case please? The following works fine for me:
When I press the escape key the window closes as expected.Code:Ext.onReady(function() { Ext.widget({ xtype: 'window', height: 100, width: 100, title: 'hi' }).show(); });Phil Guerrant
Ext JS - Development Team
-
15 Jun 2012 6:11 AM #4
Weird, it is really not reproducible with your test case.
But I am able to reproduce with this one.
It is reproducible with 4.1.1 rc2 as well.Code:Ext.onReady(function () { Ext.create("Ext.window.Window", { height : 100, width : 200, hidden : false, html : "Press Esc", renderTo : Ext.getBody() }); });
-
15 Jun 2012 9:30 AM #5
It's enabled on show.
Must never explicitly go through show if you use renderTo.Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
15 Jun 2012 9:34 AM #6
Uncomment that test. And make it "if (me.hidden) {"
It only needs to disable it if it's hidden.Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
26 Jun 2012 9:31 PM #7
The act of rendering does not focus a Component.
It's the show process, and resulting toFront process which does that for a Window.
The solution is to use the code that Phil posted. Call show, and the Window will autoRender and focus.Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
27 Jun 2012 12:59 AM #8
Hi,
Ok, it's not auto-focused. But a user can focus that Window manually and expect it will be closed on Esc. No?
-
27 Jun 2012 1:54 AM #9
Yes, if you focus it, then it's KeyMap will receive key events, and listen for ESC.
You should not use renderTo for Windows. They autoRender just in time when you first show them.Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
27 Jun 2012 4:14 AM #10
Thanks for the advice.
But will it be rendered in Ext.getBody() all the time?
What about if a developer would like to render the Window into a <form> which is within the <body>? To cause the Window input elements to be automatically submitted.
Success! Looks like we've fixed this one. According to our records the fix was applied for
EXTJSIV-6547
in
4.1.


Reply With Quote