1. #1
    Ext User
    Join Date
    Nov 2010
    Location
    Ohio
    Posts
    2
    Vote Rating
    0
    JonSobel is on a distinguished road

      0  

    Default Ext.Window key ESC does not work after onclick

    Ext.Window key ESC does not work after onclick


    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.

    Code:
    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.

  2. #2
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,546
    Vote Rating
    64
    Animal is a jewel in the rough Animal is a jewel in the rough Animal is a jewel in the rough

      0  

    Default


    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.

  3. #3
    Ext User
    Join Date
    Nov 2010
    Location
    Ohio
    Posts
    2
    Vote Rating
    0
    JonSobel is on a distinguished road

      0  

    Default


    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?

Similar Threads

  1. Closing Window widget when ESC key is pressed
    By Umashanthi in forum Ext GWT: Discussion
    Replies: 5
    Last Post: 2 Aug 2010, 8:40 AM
  2. esc key not working
    By businessman332211 in forum Ext 2.x: Help & Discussion
    Replies: 6
    Last Post: 17 Dec 2008, 12:28 PM
  3. [2.2] Disabled window closable using esc key in FF3
    By The0s in forum Ext 2.x: Bugs
    Replies: 0
    Last Post: 20 Oct 2008, 7:01 AM
  4. treeeditor with esc key
    By cecol in forum Ext 1.x: Help & Discussion
    Replies: 0
    Last Post: 1 Jan 2008, 11:09 PM

Thread Participants: 1

Tags for this Thread