Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-16556] AlertDialog: ButtonNames buttons are shown in opposite order of their position in array

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2018-08-21T19:59:03.000+0000
Affected Version/sn/a
Fix Version/sn/a
Componentsn/a
Labelsandroid
ReporterTim Poulsen
AssigneeUnknown
Created2014-03-03T15:17:42.000+0000
Updated2018-08-21T19:59:03.000+0000

Description

Buttons added to the ButtonNames array should be displayed in the order, left to right, as their position in the array. In other words, the first button in the array should be shown first on the left. They are shown in opposite order (first is on the right)

Attachments

FileDateSize
app.zip2014-03-03T15:17:42.000+00005938786
Screen Shot 2014-03-03 at 10.15.11 AM.png2014-03-03T15:17:42.000+000030690

Comments

  1. Tim Poulsen 2014-03-05

    This is not an Alloy bug. It happens with Classic code as well. Test case:
       Ti.UI.setBackgroundColor('white');
       var win = Ti.UI.createWindow({  
         backgroundColor: 'white'
       });
       var lbl = Ti.UI.createLabel({
           textid: "msg",
           top: "25"
       });
       win.add(lbl);
       
       var dialog = Ti.UI.createAlertDialog({
           buttonNames: ['Confirm', 'Cancel', 'Help'],
           message: 'Would you like to delete the file?',
           title: 'Delete'
       });
       
       win.addEventListener('open', function() {
           dialog.show();
       
       });
       
       win.open();
       
  2. Chris Bowley 2015-05-08

    [~ingo] This has been raised as an issue by ACE. To follow both the iOS and Android design guidelines requires some nasty branching. Can we get this prioritised?
  3. Shawn Lan 2015-05-09

    This is not a bug since before ICS the default order is "OK/Cancel." Starting ICS, the order is changed to "Cancel/OK." So if I have an alertdialog like this: var dialog = Ti.UI.createAlertDialog({ cancel: 1, buttonNames: ['OK', 'Cancel'], message: 'message', title: 'title' }); It adapts to platform's default automatically.
  4. Chris Bowley 2015-05-11

    [~shawnlan] looking at the design guidelines for iOS and Android, for non-destructive alerts (which I think should be the default), the button order should be the same: Android http://developer.android.com/design/building-blocks/dialogs.html "The dismissive action of a dialog is always on the left. Dismissive actions return to the user to the previous state. The affirmative actions are on the right. Affirmative actions continue progress toward the user goal that triggered the dialog." Order: Cancel | OK iOS https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/Alerts.html "When the most likely button performs a nondestructive action, it should be on the right in a two-button alert. The button that cancels this action should be on the left." Order: Cancel | OK
  5. Shawn Lan 2015-05-11

    Sorry I'm not talking about iOS vs Android. I'm talking about Android 14+ vs earlier versions. Check this: http://stackoverflow.com/questions/12705058/ok-cancel-buttons-order-in-ics
  6. Ingo Muschenetz 2015-05-11

    [~shawnlan] FYI, we don't support versions earlier than ICS as of 4.0.
  7. Joshua Quick 2018-08-21

    This is not a bug. Android 4.0 reversed the button order in dialogs from left-to-right (Windows style) to right-to-left (Apple style). So, if given button array ["OK", "Cancel"], on Android 2.2 it would appear [OK][Cancel] and on Android 4.0 it would appear [Cancel][OK]. This is the correct behavior and respects the native UI guidelines of the environment.

JSON Source