Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16957] iOS : Opening popover on iPad breaks focus/blur events of the current window

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionFixed
Resolution Date2014-07-02T16:49:01.000+0000
Affected Version/sRelease 3.2.3
Fix Version/sRelease 3.3.0, Release 3.4.0
ComponentsiOS
Labelsmodule_popover, qe-manualtest, qe-testadded
ReporterAndrey Pervushin
AssigneePedro Enrique
Created2014-05-12T15:52:17.000+0000
Updated2014-08-15T22:57:40.000+0000

Description

example:

var win = Ti.UI.createWindow();
win.addEventListener('focus', function(){
    Ti.API.log('focus');
});
win.addEventListener('blur', function(){
    Ti.API.log('blur');
});

var button = Ti.UI.createButton({title: 'Open Popover!'});
button.addEventListener('click', function(e){
    popover.show({ view: button });
});
win.add(button);

var view = Ti.UI.createView({backgroundColor: 'green'});
view.add(Ti.UI.createLabel({text: "It's not easy being green."}));

var rightButton = Ti.UI.createButton({title: 'Robin'});
rightButton.addEventListener('click', function(e){
    alert("But green's the color of spring.");
});

var popover = Ti.UI.iPad.createPopover({
    width: 250,
    height: 100,
    contentView : Ti.UI.createWindow({}),
});
popover.add(view);

win.open();

Comments

  1. Ritu Agrawal 2014-05-14

    Just to make sure that I understand this issue correctly, you are expecting only focus event once and no blur event on win object when popover is opened and closed. Let me know what is the output you are expecting in this case.
  2. Andrey Pervushin 2014-05-14

    sure, i expect blur event from main window on open popover (wich ok at first) and focus event on popover hide (wich is not working) but the main problem that after opening popover focus/blur event of the window doesn't work at all no mater what you do (switching tabs etc)
  3. Ritu Agrawal 2014-05-14

    [~rian] Thanks for the clarification.
  4. Ritu Agrawal 2014-05-14

    Moving this ticket to engineering as I can reproduce the issue with the provided test case.
  5. Andrey Pervushin 2014-06-27

    Is there any news on fixing it?
  6. Ingo Muschenetz 2014-06-28

    Resolving as suggested.
  7. Andrey Pervushin 2014-06-28

    What do you mean "Won't Fix"? Why?
  8. Ingo Muschenetz 2014-06-29

    I honestly don't know why I resolved this as "Won't Fix." I may have resolved the wrong ticket. Reopening.
  9. Pedro Enrique 2014-07-01

    Note

    Popovers are not meant to be reused. Use this code, is a refactored code from the code in the description.

    Test code

       function popOver() {
           var contentView = Ti.UI.createWindow();
           var view = Ti.UI.createView({
               backgroundColor: 'green'
           });
           var label = Ti.UI.createLabel({text: "It's not easy being green."})
           view.add(label);
           contentView.add(view);
           var rightButton = Ti.UI.createButton({
               title: 'Robin'
           });
           rightButton.addEventListener('click', function(e){
               alert("But green's the color of spring.");
           });
           var popover = Ti.UI.iPad.createPopover({
               width: 250,
               height: 100,
               contentView : contentView
           });
           contentView.addEventListener('focus', function(){
               Ti.API.info('popover.window.focus');
           });
           contentView.addEventListener('blur', function(){
               Ti.API.info('popover.window.blur');
           });
           return popover;
       }
       var win = Ti.UI.createWindow({
           backgroundColor: 'white'
       });
       win.addEventListener('focus', function(){
           Ti.API.log('base.window.focus');
       });
       win.addEventListener('blur', function(){
           Ti.API.log('base.window.blur');
       });
        
       var button = Ti.UI.createButton({
           title: 'Open Popover!'
       });
       button.addEventListener('click', function(e){
           popOver().show({ view: button });
       });
       win.add(button); 
       win.open();
       

    PR:

    master: https://github.com/appcelerator/titanium_mobile/pull/5877 3.3.x: https://github.com/appcelerator/titanium_mobile/pull/5878
  10. Samuel Dowse 2014-07-02

    Verified fixed on: Mac OSX 10.9.4 Appcelerator Studio, build: 3.3.0.201406271159 Titanium SDK, build: 3.3.0.v20140702094913 Titanium CLI, build: 3.3.0-rc4 Alloy: 1.4.0-rc3 Xcode: 5.1.1 iOS Device: iPad Air (7.1.2) iOS Simulator: iPad (7.1) Used test code provided by [~penrique]. Focus and blur events of the popover window and base window successfully called multiple times.
        [INFO] :   base.window.focus
        [INFO] :   base.window.blur
        [INFO] :   popover.window.focus
        [INFO] :   popover.window.blur
        [INFO] :   base.window.focus
        
    Closing.

JSON Source