Problem
The Android back hardware button triggers optionDialog's click event. The click event shouldn't be triggered because of the fact dialog isn't clicked/touched with finger (back button is).
Test case
* run code below
* click on the button so that optionDialog shows
* hit the hardware back-button. You'll see that this triggers dialog's click event.
var win = Ti.UI.createWindow({
modal: true,
backgroundColor: '#000'
});
var button = Ti.UI.createButton({
title: 'Open dialog'
});
button.addEventListener('click', function() {
var dialog = Ti.UI.createOptionDialog({
options: ['Option 1', 'Option 2', 'Option 3'],
title: 'Options'
});
dialog.addEventListener('click', function(e) {
Ti.API.info('Dialog click event!');
Ti.API.debug(e);
});
dialog.show();
});
win.add(button);
win.open();
Results
Dialog click event!
{"cancel":false,"index":-268435457,"source":{"size":{"height":0,"width":0},"children":[],"height":0,"width":0,"center":{"y":0,"x":0},"options":["Option 1","Option 2","Option 3"],"title":"Options","keepScreenOn":false,"_events":{}},"button":true,"type":"click"}
Discussions
See [this Q&A question](
http://developer.appcelerator.com/question/127291/android-back-button-triggers-option-dialogs-click-event).
Ivan, thank you for raising this ticket. Please note the changes I made to bring it in line with the [JIRA Ticket Checklist](https://wiki.appcelerator.org/display/guides/How+to+Submit+a+Bug+Report#HowtoSubmitaBugReport-JIRATicketChecklist). Unfortunately we cannot accept more than one issue or request in a single ticket. Would you raise an new feature request ticket for the following, if you still think it is valid? Cheers
May I know why this simple issue is not fixed yet ?
PR https://github.com/appcelerator/titanium_mobile/pull/9476