PDA

View Full Version : Ext.Window key ESC does not work after onclick



JonSobel
9 Nov 2010, 1:22 PM
This code opens a modal window with an image of a graph inside. If you do not click on the window, you can use the Esc key to close the window. However, once you click on the modal window, it will no longer close using the Esc key. The code is below.


var win = new Ext.Window({
bodyStyle: 'background-color: white;',
width: 800,
height: 600,
title: 'Signup Activity',
closable: true,
closeAction: 'close',
modal: true,
layout: 'fit',
resizable: false,
html: '<img id="popupImg" align="center" alt="Loading Public Signup Activity Chart" src="'
+ pageConfig.ctx
+ '/chart/publicSignupActivityLineChart.html?psDays=' + psDaysValue + '&width=786&height=568&_dt=' + dt,
keys: [{
key: 27, // close on Esc
fn: function() {
win.close();
},
stopEvent: true,
scope: win
}]
});values for things like psDaysValue and others are populated just outside this method but they are there.

Animal
9 Nov 2010, 1:25 PM
There has to be some element focused to receive the keystroke. If you blur the Window's hidden <a> element which functions as its focus holder, there's nothing active receiving keystrokes.

JonSobel
9 Nov 2010, 1:44 PM
So a click on the window that opens removes the focus from its <a> tag? Shouldn't it do just the opposite? I could see this being the case if I was clicking on the blurred portion of the window, but a click on the newly opened modal window will remove that focus?