diff --git a/core/includes/form.inc b/core/includes/form.inc
index 3ebaca1..1c94c38 100644
--- a/core/includes/form.inc
+++ b/core/includes/form.inc
@@ -1966,13 +1966,15 @@ function form_builder($form_id, &$element, &$form_state) {
       $element['#attributes']['enctype'] = 'multipart/form-data';
     }
 
-    // If a form contains a single textfield, and the ENTER key is pressed
-    // within it, Internet Explorer submits the form with no POST data
-    // identifying any submit button. Other browsers submit POST data as though
-    // the user clicked the first button. Therefore, to be as consistent as we
-    // can be across browsers, if no 'triggering_element' has been identified
-    // yet, default it to the first button.
-    if (!$form_state['programmed'] && !isset($form_state['triggering_element']) && !empty($form_state['buttons'])) {
+    // Programmatic form submissions made using drupal_form_submit() often do
+    // not specify the submit button that was "clicked". In addition, if a form
+    // contains a single textfield, and the ENTER key is pressed within it,
+    // Internet Explorer submits the form with no POST data identifying any
+    // submit button. Other browsers submit POST data as though the user
+    // clicked the first button. Therefore, to be as consistent as we can be
+    // across browsers, if no 'triggering_element' has been identified yet,
+    // default it to the first button.
+    if (!isset($form_state['triggering_element']) && !empty($form_state['buttons'])) {
       $form_state['triggering_element'] = $form_state['buttons'][0];
     }
 
