[TIMOB-16560] iOS: Window focus/blur events do not fire after animating the navigation window
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Low |
Status | Closed |
Resolution | Won't Fix |
Resolution Date | 2016-10-19T14:15:55.000+0000 |
Affected Version/s | Release 3.2.1 |
Fix Version/s | n/a |
Components | iOS |
Labels | 3.2.1, blur, bug, events, focus, ios, iphone, navigationWindow |
Reporter | Felipe Mathies |
Assignee | Eric Merriman |
Created | 2014-03-01T03:08:54.000+0000 |
Updated | 2017-03-29T17:53:26.000+0000 |
Description
After my app refactoring to use navigationWindow instead navGroup, all the focus/blur events on the windows inside the navigationWindow stopped to fire up, after doing alot tests, i think i found what is causing the problem...
on my app theres 2 active window on the screen one window is the sideMenu thats stays behind and the other is the navigationWindow, with this setup the events dosent fireup like i described, but when i remove the sideMenu window all the events starts to fire up as usual
so when theres 2 top level windows(window, navigationWindow) on the screen the views inside navigationWindow dosent got focus/blur events fired up, on the moment theres only one window, all backs to normal
var height = Ti.Platform.displayCaps.platformHeight;
var width = Ti.Platform.displayCaps.platformWidth;
var isToggled = false;
var win = Ti.UI.createWindow({ width : width, height : height, backgroundColor : "pink" });
var nextWin = Ti.UI.createWindow({ width : width, height : height, backgroundColor : "blue" });
var buttonNext = Ti.UI.createButton({ title : "next window" });
var buttonMenu = Ti.UI.createButton({ title : "MENU", top : 60, left : 10 });
win.add(buttonMenu);
win.add(buttonNext);
var navigation = Titanium.UI.iOS.createNavigationWindow({ backgroundColor : 'grey', window : win, width : width, height : height, });
win.addEventListener('focus', function() { Ti.API.log("win focus"); });
nextWin.addEventListener('focus', function() { Ti.API.log("next win focus"); });
buttonNext.addEventListener('click', function() { navigation.openWindow(nextWin); });
buttonMenu.addEventListener('click', function() { toggleMenu(); });
var animateLeft = Ti.UI.createAnimation({ left : 180, curve : Ti.UI.ANIMATION_CURVE_EASE_OUT, duration : 500 });
var animateRight = Ti.UI.createAnimation({ left : 0, curve : Ti.UI.ANIMATION_CURVE_EASE_OUT, duration : 500 });
var toggleMenu = function() {
if (!isToggled) { navigation.animate(animateLeft); isToggled = true; } else { navigation.animate(animateRight); isToggled = false; }
};
navigation.open();
Can you please attach a simple runnable test case so that we can take a look and try to reproduce the issue in-house.
yes sure, after isolating the problem i discovery that the problem is with the animation, on me moment when you apply an animation to the navigationWindow the events focus/blur stop firing, so heres the example: Instructions First click on "next window" button and the events focus from the next window fires up just fine, go back, and press "MENU" twice to move the window right/left, and after that if you go "next window" again the focus event dosent fire up anymore...
Moving this ticket to engineering as I can reproduce this issue with 3.2.1 release.
Having the identical issue with 3.2.2.GA release - reproduced with example above and also with my own code. Focus events no longer fire after navigation window is animated. Affects me the same way - have a sliding top window and menu underneath. Moving the navigation window causing app to fail after focus events don't fire. Tested with iOS 7.1
Also happens with TabGroups. After you animate a TabGroup, if you open in window in the active Tab [activeTab.openWindow(newWindow);] the focus event on the newWindow never fires. Tested with 3.3.0RC2 and iOS7.1 Simulator. Let me know if you need a simple runnable test case.
Issue reproduces Titanium Command-Line Interface, CLI version 3.3.0, Titanium SDK version 3.3.0.GA iOS SDK: 7.1 iOS iPhone Simulator: 7.1
Issue reproduces Appcelerator Studio version 4.6.0, Titanium SDK version 5.2.3.GA iOS SDK: 9.3 iOS iPhone Simulator: 9.3 This bug will be fixed one day ?
Ok, here is the thing: When you are animating a window (manually), it never loses the technical focus, because it is just moved on the x-axis like in this case. It may become invisible to the currently visible area of the user, but it never loses focus to another window / top-level-container. The exactly same would happen to a native
UINavigationController
if you animate it like this. I actually came across this "issue" a few years ago and I fixed it quite quickly by using callbacks that listen to the animations and click-events of the toggle-button. If someone needs the above example demonstrated with clean callbacks, let me know. But I would highly suggest to close this issue afterwards, since it's a matter of programming-style to get the proper trigger when needing them. Thanks!Since we didn't receive any feedback regarding this, I think the stated reasons make sense here. Resolving ticket for now, thx!
Closing ticket as "Won't Fix", with reference to the above comments.