Project: titanium
Issue TIMOB-18476: iOS: After a Popover hides, Apps stop getting focus events on Tabs’ windows
When you open a Popover and then hide it you stop getting {{focus}} events on the Tabs and on the Tabs’ Windows. You still get {{focus}} events on the TabGroup itself. Opening a modal Window and closing it restores the situation to the normal behaviour. With the attached code as {{app.js}} follow this steps to better understand the issue. Reproduced is also the modal’s restoring effect. h2. Steps # Click on the second tab # Click on the "Open popover" # Click on "close" (or click outside the popover) # Click on the first tab # Click on the "Open modal" button # Click on the "close" button # Click on the second tab h2. Expected result {code} [ERROR] : Received focus for TabGroup [ERROR] : Received focus for Tab 1 [ERROR] : Received focus for Window 1 [ERROR] : Received focus for TabGroup [ERROR] : Received focus for Tab 2 [ERROR] : Received focus for Window 2 [ERROR] : Received focus for TabGroup [ERROR] : Received focus for Tab 1 # THIS LINE IS MISSING [ERROR] : Received focus for Window 1 # THIS LINE IS MISSING [ERROR] : Received focus for Modal [ERROR] : Received focus for Window 1 [ERROR] : Received focus for Tab 1 [ERROR] : Received close for Modal [ERROR] : Received focus for TabGroup [ERROR] : Received focus for Window 2 [ERROR] : Received focus for Tab 2 {code} h2. Actual result {code} [ERROR] : Received focus for TabGroup [ERROR] : Received focus for Tab 1 [ERROR] : Received focus for Window 1 [ERROR] : Received focus for TabGroup [ERROR] : Received focus for Tab 2 [ERROR] : Received focus for Window 2 [ERROR] : Received focus for TabGroup [ERROR] : Received focus for Modal [ERROR] : Received focus for Window 1 [ERROR] : Received focus for Tab 1 [ERROR] : Received close for Modal [ERROR] : Received focus for TabGroup [ERROR] : Received focus for Window 2 [ERROR] : Received focus for Tab 2 {code} h2. Attached code {code:javascript} var tabGroup = Ti.UI.createTabGroup({ title: 'TabGroup' }); var window1 = Ti.UI.createWindow({ title: 'Window 1' }); var window2 = Ti.UI.createWindow({ title: 'Window 2' }); var tab1 = Ti.UI.createTab({ window: window1, title: 'Tab 1' }); var tab2 = Ti.UI.createTab({ window: window2, title: 'Tab 2' }); tabGroup.addTab(tab1); tabGroup.addTab(tab2); // Modals var modalButton = Ti.UI.createButton({ title: 'Open modal' }); window1.add(modalButton); modalButton.addEventListener('click', function () {	var close = Ti.UI.createButton({ title: 'close' });	var modal = Ti.UI.createWindow({ modal: true, title: 'Modal' });	modal.add(close);	modal.addEventListener('focus', onEvent);	modal.addEventListener('close', onEvent);	close.addEventListener('click', function () {	modal.close();	});	modal.open(); }); // Popover var popoverButton = Ti.UI.createButton({ title: 'Open popover' }); window2.add(popoverButton); popoverButton.addEventListener('click', function () {	var close = Ti.UI.createButton({ title: 'close' });	var content = Ti.UI.createView({ title: 'Popover Content View' });	content.backgroundColor = 'white';	content.width = 200;	content.height = 200;	content.add(close);	var popover = Ti.UI.iPad.createPopover({ contentView: content });	close.addEventListener('click', function () {	popover.hide();	});	popover.show({ view: popoverButton }); }); // Listeners [ tabGroup, window1, window2, tab1, tab2 ].forEach(function (view) {	view.addEventListener('focus', onEvent); }); function onEvent(event) {	Ti.API.error("Received " + event.type + " for " + event.source.title); } // Open the tab group tabGroup.open(); {code}
Story points: 8