[TIMOB-20560] Android: A button will fire an event listener for the button and the window
| GitHub Issue | n/a | 
|---|---|
| Type | Bug | 
| Priority | Medium | 
| Status | Closed | 
| Resolution | Invalid | 
| Resolution Date | 2017-05-03T12:23:29.000+0000 | 
| Affected Version/s | Release 5.2.1 | 
| Fix Version/s | n/a | 
| Components | Android | 
| Labels | qe-5.2.1 | 
| Reporter | Josh Longton | 
| Assignee | Gary Mathews | 
| Created | 2016-03-11T23:45:41.000+0000 | 
| Updated | 2018-08-06T17:37:01.000+0000 | 
Description
	A button will fire an event listener for the button and the window  
*Steps to reproduce:* 
Use the app.js bellow
*Actual :* Both events are fired when the button is clicked *Expected:* Only the button event is fired when the button is clicked and only the window event is fired when the window is clicked *App.js:*
var window = Ti.UI.createWindow();
var button = Titanium.UI.createButton({title: 'click'});
	window.add(button);
button.addEventListener('click', function() {
	// alert('Button');
	window.close();
});
	
window.addEventListener('click', function() {
	
	// alert('Window');
        Titanium.Media.openPhotoGallery({
            success: function(event) {
                alert('success');
            },
            cancel: function(cancel) {
                alert('cancel');
            },
            error: function(error) {
                alert('error');
            }
        });
    });
     window.open();
[~jlongton] This is expected behaviour (http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Proxy-property-bubbleParent) "Some proxies (most commonly views) have a relationship to other proxies, often established by the add() method. For example, for a button added to a window, a click event on the button would bubble up to the window." And can be controlled by
bubbleParentvar win = Ti.UI.createWindow(), btn = Titanium.UI.createButton({ title: 'BUTTON', bubbleParent: false }); btn.addEventListener('click', function() { alert('button'); }); win.addEventListener('click', function() { alert('window'); }); win.add(btn); win.open();Closing as invalid. If incorrect, please reopen.