Project: titanium
Issue TIMOB-23366: Windows: Hardware back button exits app instead of closing window inside tab
Looking at other Windows apps the expected behaviour when using {{Ti.UI.Tab.open()}} to open a child Window and then pressing the device back button should close the child Window, revealing the previous Window again. Example for all of this: {code:js} var colors = ['blue', 'gray', 'red']; function createWindow(depth) { var win = Ti.UI.createWindow({ layout: 'vertical', backgroundColor: colors[depth % colors.length] }); 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: 5