Recently I have encountered the strange behavior of setting form created with Form API in Drupal 8.
I am using #states to hide one of the form elements ( radios ) when another element is empty. The problem is - it doesn't work with Aggregate JavaScript files option. After you submit the form, this element is still visible - even if condition to hide it is fulfilled.
When I disable Aggregate JavaScript files option, it works as expected - radios are hidden.
Is there anything I can do to solve this problem?
$form['login'] = [ '#type' => 'textfield', '#title' => t('Your login:'), '#default_value' => $config->get('login'), '#states' => array( 'visible' => array( ':input[name="settings"]' => array('value' => '1') ), ) ];
Is there anything more to make states work?