New window focus on Mac OS X 10.9.2

0 views
Skip to first unread message

tiitr...@gmail.com

unread,
Mar 23, 2014, 5:25:10 AM3/23/14
to node-...@googlegroups.com
When you open new window with focus:true then new window will have focus, but not in DOM elements
Sample 1.
var gui = require('nw.gui');
nwin = gui.Window.open('someurl.html', {
        position: 'center',
        toolbar: true,
        focus: true,
        width:  500,
        height: 500
    });

This won't focus someurl.html first element (like input or something). <body onload="document.getElementsByTagName("input")[0].focus()">

Sample 2.
var gui = require('nw.gui');
nwin = gui.Window.open('someurl.html', {
        position: 'center',
        toolbar: true,
        width:  500,
        height: 500
    });
nwin.on('document-end',function(){          //also works with 'loaded' event
     nwin.focus();
});

Sample 2 is working. I'm not sure if it's a bug, but at least both samples work in Windows 7 SP1 Professional x64, but only sample 2 is working on Mac OS X 10.9.2
Reply all
Reply to author
Forward
0 new messages