#states is not working when field type is managed_file. If I am changing its type to file or something else like textfield then #states is working.
This issue is occurring on latest 8.4.x dev branch.

Sample code.

$form['field1'] = array(
      '#type' => 'select',
      '#title' => $this->t('Field 1'),
      '#options' => array('op1' => 'op1', 'op2' => 'op2'),
    );

    $form['field2'] = array(
      '#title' => $this->t('Field 2'),
      '#type' => 'managed_file',
      '#upload_validators' => array(
        'file_validate_extensions' => array('jpg png gif jpeg')
        ),
      '#upload_location' => 'public://import/',
      '#states' => array(
        'visible' => array(
          ':input[name="field1"]' => array(
            'value' => 'op2'
            )
          )
        )
      );

Comments

shashikant_chauhan created an issue.