diff --git a/conditional_fields.api.inc b/conditional_fields.api.inc
index ea5f492..ebe3054 100644
--- a/conditional_fields.api.inc
+++ b/conditional_fields.api.inc
@@ -5,6 +5,7 @@
  * Contains conditional fields logic of modify forms.
  */
 
+use Drupal\Core\Entity\Entity\EntityFormDisplay;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Component\Utility\NestedArray;
 use Drupal\Core\Field\WidgetBase;
@@ -40,6 +41,7 @@ function conditional_fields_form_after_build($form, FormStateInterface &$form_st
   }
 
   $effects = [];
+  $entity_info = $form_state->get('conditional_fields_entity_info');
 
   $form_obj = $form_state->getFormObject();
   if (method_exists($form_obj, 'getFormDisplay')) {
@@ -58,7 +60,8 @@ function conditional_fields_form_after_build($form, FormStateInterface &$form_st
       continue;
     }
 
-    $dependent_location = array_merge([], array($dependent));
+    $dependent_base_parents = isset($dependent_info['ief_parents']) ? $dependent_info['ief_parents'] : [];
+    $dependent_location = array_merge($dependent_base_parents, array($dependent));
     $dependent_form_field = NestedArray::getValue($form, $dependent_location);
 
     // Cycle the dependant's dependees.
@@ -77,16 +80,25 @@ function conditional_fields_form_after_build($form, FormStateInterface &$form_st
         unset($dependee_info['parents'][$unset]);
       }
 
-      $dependee_form_field = NestedArray::getValue($form, $dependee_info['parents']);
-      $options = $dependency['options'];
+      $dependee_base_parents = isset($dependee_info['ief_parents']) ? $dependee_info['ief_parents'] : [];
+      $dependee_location = array_merge($dependee_base_parents, $dependee_info['parents']);
+      $dependee_form_field = NestedArray::getValue($form, $dependee_location);
 
+      $options = $dependency['options'];
       if (!empty($options['values']) && is_string($options['values'])) {
         $options['values'] = explode("\r\n", $options['values']);
       }
-
       $options['selector'] = conditional_fields_get_selector($options['selector'], $dependee_form_field);
 
-      $state = conditional_fields_get_state($form_display, $dependee, $dependee_form_field, $options);
+      $real_form_display = $form_display;
+      if (\Drupal::moduleHandler()->moduleExists('inline_entity_form')) {
+        $element = inline_entity_form_get_element($form, $form_state);
+        if (isset($element['#ief_id'])) {
+          $form_mode = $element['form']['inline_entity_form']['#form_mode'];
+          $real_form_display = EntityFormDisplay::collectRenderDisplay($entity_info['entity'], $form_mode);
+        }
+      }
+      $state = conditional_fields_get_state($real_form_display, $dependee, $dependee_form_field, $options);
 
       // Add validation callback to element if the dependency can be evaluated.
       if (in_array($options['condition'], array(
diff --git a/conditional_fields.module b/conditional_fields.module
index e5e7aff..8d2bc89 100644
--- a/conditional_fields.module
+++ b/conditional_fields.module
@@ -178,7 +178,8 @@ function conditional_fields_element_after_build($element, FormStateInterface &$f
   // and their dependencies will not be loaded.
   $build_info = $form_state->getBuildInfo();
   if (method_exists($build_info['callback_object'], 'getEntity')) {
-    $entity = $build_info['callback_object']->getEntity();
+    $entity_info = $form_state->get('conditional_fields_entity_info');
+    $entity = $entity_info ? $entity_info['entity'] : $build_info['callback_object']->getEntity();
     if ($entity instanceof EntityInterface) {
       $bundle = $entity->bundle();
       $entity_type = $entity->getEntityTypeId();
@@ -194,7 +195,12 @@ function conditional_fields_element_after_build($element, FormStateInterface &$f
         return $element;
       }
 
-      $field_name = reset($field['#array_parents']);
+      if ($inline_form_position = array_search('inline_entity_form', $field['#array_parents'])) {
+        $field_name = $field['#array_parents'][$inline_form_position + 1];
+      }
+      else {
+        $field_name = reset($field['#array_parents']);
+      }
       // Attach dependent.
       if (isset($dependencies['dependents'][$field_name])) {
         foreach ($dependencies['dependents'][$field_name] as $id => $dependency) {
@@ -354,8 +360,17 @@ function conditional_fields_attach_dependency(&$form, $dependee, $dependent, $op
   // Use the #array_parents property of the dependee instead of #field_parents
   // since we will need access to the full structure of the widget.
   if (isset($dependee['#parents'])) {
-    $form['#conditional_fields'][$dependee['#parents'][0]]['parents'] = $dependee['#array_parents'];
-    $form['#conditional_fields'][$dependee['#parents'][0]]['dependents'][$id] = array(
+    if ($inline_form_position = array_search('inline_entity_form', $dependee['#array_parents'])) {
+      $field_name = $dependee['#array_parents'][$inline_form_position + 1];
+      $ief_parents = array_splice($dependee['#array_parents'], 0, $inline_form_position + 1);
+    }
+    else {
+      $field_name = $dependee['#parents'][0];
+      $ief_parents = [];
+    }
+    $form['#conditional_fields'][$field_name]['parents'] = $dependee['#array_parents'];
+    $form['#conditional_fields'][$field_name]['ief_parents'] = $ief_parents;
+    $form['#conditional_fields'][$field_name]['dependents'][$id] = array(
       'dependent' => $dependent['#field_name'],
       'options' => $options,
     );
@@ -369,8 +384,17 @@ function conditional_fields_attach_dependency(&$form, $dependee, $dependent, $op
     $dependent_parents = $dependent['#field_parents'];
   }
   if (isset($dependent_parents)) {
-    $form['#conditional_fields'][$dependent['#parents'][0]]['field_parents'] = $dependent_parents;
-    $form['#conditional_fields'][$dependent['#parents'][0]]['dependees'][$id] = array(
+    if ($inline_form_position = array_search('inline_entity_form', $dependent['#array_parents'])) {
+      $field_name = $dependent['#array_parents'][$inline_form_position + 1];
+      $ief_parents = array_splice($dependent['#array_parents'], 0, $inline_form_position + 1);
+    }
+    else {
+      $field_name = $dependent['#parents'][0];
+      $ief_parents = [];
+    }
+    $form['#conditional_fields'][$field_name]['field_parents'] = $dependent_parents;
+    $form['#conditional_fields'][$field_name]['ief_parents'] = $ief_parents;
+    $form['#conditional_fields'][$field_name]['dependees'][$id] = array(
       'dependee' => $dependee['#field_name'],
       'options' => $options,
     );
