Titanium JIRA Archive
Appcelerator Community (AC)

[AC-4871] androidback event will always bubble

GitHub Issuen/a
TypeBug
Priorityn/a
StatusClosed
ResolutionDuplicate
Resolution Date2017-03-23T13:59:23.000+0000
Affected Version/sn/a
Fix Version/sn/a
ComponentsTitanium SDK & CLI
Labelsandroid, backbutton
ReporterCreative
AssigneeShak Hossain
Created2017-03-22T15:00:39.000+0000
Updated2017-03-23T13:59:23.000+0000

Description

Testcase: * Create a Window * Attach an event listener using:
// Somecontroller.js 
$.getView().addEventListener('androidback', function(e) {
e.cancelBubble = true;
return false;
});
* Press the native back-button on Android Expected: The window should remain open. Result: The window will close regardless. Workaround: handling the event *android:back* (which is presumably deprecated?) +does+ seem to prevent the window from closing, as soon as you define it. I'm confused as to why it was deprecated since it seems to work better. Also, no console warning is thrown by still using the deprecated event.

Comments

  1. Sharif AbuDarda 2017-03-22

    Hello, I can't reproduce the issue as described. I am using the same code
       $.container.open();
       
       $.container.addEventListener('androidback', function(e) {
           e.cancelBubble = true;
           return false;
       }); 
       
       <Alloy>
       	<Window id="container">
       	</Window>
       </Alloy>
       
    Window stays open in Android 6.0.1. Tested in SDK 6.0.2.GA. Thanks.
  2. Creative 2017-03-23

  3. Sharif AbuDarda 2017-03-23

JSON Source