Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16104] iOS: NavigationWindow does not fire "focus" and "blur" events for child windows after being animated

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionDuplicate
Resolution Date2016-10-19T14:16:57.000+0000
Affected Version/sRelease 3.2.0
Fix Version/sn/a
ComponentsiOS
LabelsNavigationGroup, NavigationWindow, animations, blur, focus, ios7
ReporterVladimir Tolstikov
AssigneeEric Merriman
Created2013-12-24T14:17:40.000+0000
Updated2017-03-29T22:02:36.000+0000

Description

I'm using NavigationWindow to create windows(screens) flow in our App. Also I have side-menu there (another window below NavigationWindow) which I show on "Menu" button click by animating NavigationWindow to the right (see attached screenshot). I found, what if I animate NavigationWindow with "animate" method -- windows inside NavigationWindow loses focus and no longer receive "focus" and "blur" events (maybe some other events too, dunno). Even newly created windows not receive those events too. I have some vital functional (as timers creation and other stuff) linked to those events, so I need them in working condition. Before I used NavigationGroup and all was fine with it, but now it's deprecated. Code to reproduce:
var win1 = Ti.UI.createWindow({
    backgroundColor: 'white'
});

win1.addEventListener('click', function(){
    navWindow.openWindow(win2);
});

win1.addEventListener('focus', function(){
    Ti.API.info((new Date()) + ' win1:focus');
});

win1.addEventListener('blur', function(){
    Ti.API.info((new Date()) + ' win1:blur');
});

var win2 = Ti.UI.createWindow({
    backgroundColor: 'red'
});

win2.addEventListener('click', function(){
    navWindow.closeWindow(win2);
});

var navWindow = Ti.UI.iOS.createNavigationWindow({
    backgroundColor:'#ffffff',
    backgroundImage: 'Default.png',
    window: win1,
});

navWindow.open();

// Setup deferred animation of navWindow (for simplify things)
setTimeout(function(){
    Ti.API.info((new Date()) + ' animated');
    navWindow.animate({
        duration: 1000, // here I just show what any animation breaks the things
    });
}, 10000);
You can click on window to open another one and see messages in the console when you go back to first window again. Code contains auto-triggered function which "animates" navWindow after 10 seconds from app launch. After that you can no longer see focus and blur messages in the console on the same interactions with windows, but see only one last "win1:blur" (btw, when NavigationGroup was used looks like no "blur" event was fired).
[INFO] :   Tue Dec 24 2013 17:47:20 GMT+0400 (MSK) win1:focus
[INFO] :   Tue Dec 24 2013 17:47:22 GMT+0400 (MSK) win1:blur
[INFO] :   Tue Dec 24 2013 17:47:24 GMT+0400 (MSK) win1:focus
[INFO] :   Tue Dec 24 2013 17:47:24 GMT+0400 (MSK) win1:blur
[INFO] :   Tue Dec 24 2013 17:47:26 GMT+0400 (MSK) win1:focus
[INFO] :   Tue Dec 24 2013 17:47:30 GMT+0400 (MSK) animated
[INFO] :   Tue Dec 24 2013 17:47:30 GMT+0400 (MSK) win1:blur
Expected result: - some code animates NavigationWindow with NavigationWindow.animate method - windows inside NavigationWindow remains ability to receive "focus" and "blur" events Actual result: - some code animates NavigationWindow with NavigationWindow.animate method - windows inside NavigationWindow loses ability to receive "focus" and "blur" events anymore

Attachments

FileDateSize
app.js2013-12-24T14:18:50.000+00002180
screenshot_2013-12-24_17.51.43.png2013-12-24T14:17:40.000+0000229630

Comments

  1. BG 2015-07-23

    There doesn't seem to be any way to track which window has focus in a NavigationWindow because of this issue. Why is this considered such a low priority? I have a NavigationGroup consisting of 4 windows which I drill through from parent to child. I need to know when the user navigates back to the home window of the group (the first window). Is there some other way to do this I don't know about?
  2. Simon Buckingham 2016-05-04

    I am still seeing this general problem in Ti 5.1.2 (on iOS 9.3). In an iOS navigation group the window is not sending the focus event. I can't believe this is marked as low priority. This is essential UX.
  3. Lee Morris 2017-03-29

    Closing ticket as duplicate, with reference to the above links.

JSON Source