Project: titanium
Issue TIMOB-23349: Windows: Closing Windows opened via Ti.UI.Tab.open() does not work as expected
Looking at other Windows apps the expected behaviour when using {{Ti.UI.Tab.open()}} to open a child Window should be: * That the Tabs stay visible (/) * That the content of the current tab is replaced by the child Window (/) * That pressing the device back button should close the child Window, reveiling the previous Window again (x) * That calling {{Ti.UI.Tab.close()}} passing the child window should do the same (x) * That calling {{Ti.UI.Window.close()}} on the child window should do the same (x) The last three are broken and need to be fixed: * Pressing the device back button will close the app. * Calling close on the Window or via the Tab doesn't do anything. In addition, when the child window has a CommandBar, the CommandBar will be dismissed when you first call {{Ti.UI.Window.close()}}. Example for all of this: {code:js} function createWindow(depth) {	var win = Ti.UI.createWindow({	layout : 'vertical'	});	win.add(Ti.UI.createLabel({	text : 'Depth ' + depth	}));	var openBtn = Ti.UI.createButton({	top : 20,	title : 'Open Child'	});	openBtn.addEventListener('click', function() {	tabA.open(createWindow(depth + 1));	});	win.add(openBtn);	if (depth > 0) {	var closeViaWinBtn = Ti.UI.createButton({	top : 20,	title : 'Close via Window'	});	closeViaWinBtn.addEventListener('click', function() {	win.close();	});	win.add(closeViaWinBtn);	var closeViaTabBtn = Ti.UI.createButton({	top : 20,	title : 'Close via Tab'	});	closeViaTabBtn.addEventListener('click', function() {	tabA.close(win);	});	win.add(closeViaTabBtn);	var backViaWinButton = Ti.UI.Windows.createAppBarButton({	icon : Ti.UI.Windows.SystemIcon.BACK	});	backViaWinButton.addEventListener('click', function() {	win.close();	});	var backViaTabButton = Ti.UI.Windows.createAppBarButton({	icon : Ti.UI.Windows.SystemIcon.BACKTOWINDOW	});	backViaTabButton.addEventListener('click', function() {	tabA.close(win);	});	win.add(Ti.UI.Windows.createCommandBar({	items : [backViaWinButton, backViaTabButton]	}));	}	return win; } var tabA = Ti.UI.createTab({	title : 'Tab A',	window : createWindow(0) }); var tabB = Ti.UI.createTab({	title : 'Tab B',	window : Ti.UI.createWindow({	backgroundColor : 'green'	}) }); Ti.UI.createTabGroup({	tabs : [tabA, tabB] }).open(); {code}
Story points: 8