How can I detect what control caused AJAX callback?
I use this code since drupal 7, only changed the first line for drupal 8:

$triggering_element = $form_state-&gt;getTriggeringElement();
if ( isset($triggering_element) ) {
  $trigger = $triggering_element['#name'];
  if ( $trigger == 'op' ) {
    $trigger = $triggering_element['#parents']['0'];
  }
}
else {
  $trigger = '';
};


If trigger is 'op', then it is a button and i get the name from the parent.

And see comment of Ivan Jaros, make the names unique.