diff --git a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/SelectionBase.php b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/SelectionBase.php
index cb8c7d6..c9debba 100644
--- a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/SelectionBase.php
+++ b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/SelectionBase.php
@@ -41,6 +41,8 @@
  */
 class SelectionBase extends PluginBase implements SelectionInterface, ContainerFactoryPluginInterface {
 
+  use SelectionValidateTrait;
+
   /**
    * The entity manager.
    *
@@ -269,45 +271,6 @@ public function validateReferenceableEntities(array $ids) {
   }
 
   /**
-   * {@inheritdoc}
-   */
-  public function validateAutocompleteInput($input, &$element, FormStateInterface $form_state, $form, $strict = TRUE) {
-    $bundled_entities = $this->getReferenceableEntities($input, '=', 6);
-    $entities = array();
-    foreach ($bundled_entities as $entities_list) {
-      $entities += $entities_list;
-    }
-    $params = array(
-      '%value' => $input,
-      '@value' => $input,
-    );
-    if (empty($entities)) {
-      if ($strict) {
-        // Error if there are no entities available for a required field.
-        $form_state->setError($element, $this->t('There are no entities matching "%value".', $params));
-      }
-    }
-    elseif (count($entities) > 5) {
-      $params['@id'] = key($entities);
-      // Error if there are more than 5 matching entities.
-      $form_state->setError($element, $this->t('Many entities are called %value. Specify the one you want by appending the id in parentheses, like "@value (@id)".', $params));
-    }
-    elseif (count($entities) > 1) {
-      // More helpful error if there are only a few matching entities.
-      $multiples = array();
-      foreach ($entities as $id => $name) {
-        $multiples[] = $name . ' (' . $id . ')';
-      }
-      $params['@id'] = $id;
-      $form_state->setError($element, $this->t('Multiple entities match this reference; "%multiple". Specify the one you want by appending the id in parentheses, like "@value (@id)".', array('%multiple' => implode('", "', $multiples))));
-    }
-    else {
-      // Take the one and only matching entity.
-      return key($entities);
-    }
-  }
-
-  /**
    * Builds an EntityQuery to get referenceable entities.
    *
    * @param string|null $match
diff --git a/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/SelectionValidateTrait.php b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/SelectionValidateTrait.php
new file mode 100644
index 0000000..b77392a
--- /dev/null
+++ b/core/lib/Drupal/Core/Entity/Plugin/EntityReferenceSelection/SelectionValidateTrait.php
@@ -0,0 +1,56 @@
+<?php
+
+/**
+ * @file
+ * Contains \Drupal\Core\Entity\Plugin\EntityReferenceSelection\SelectionValidateTrait.
+ */
+
+namespace Drupal\Core\Entity\Plugin\EntityReferenceSelection;
+
+use Drupal\Core\Form\FormStateInterface;
+
+/**
+ * Trait for selection that validates autocomplete input.
+ */
+trait SelectionValidateTrait {
+
+  /**
+   * Implements \Drupal\Core\Entity\EntityReferenceSelection\SelectionInterface::validateAutocompleteInput().
+   */
+  public function validateAutocompleteInput($input, &$element, FormStateInterface $form_state, $form, $strict = TRUE) {
+    $bundled_entities = $this->getReferenceableEntities($input, '=', 6);
+    $entities = array();
+    foreach ($bundled_entities as $entities_list) {
+      $entities += $entities_list;
+    }
+    $params = array(
+      '%value' => $input,
+      '@value' => $input,
+    );
+    if (empty($entities)) {
+      if ($strict) {
+        // Error if there are no entities available for a required field.
+        $form_state->setError($element, $this->t('There are no entities matching "%value".', $params));
+      }
+    }
+    elseif (count($entities) > 5) {
+      $params['@id'] = key($entities);
+      // Error if there are more than 5 matching entities.
+      $form_state->setError($element, $this->t('Many entities are called %value. Specify the one you want by appending the id in parentheses, like "@value (@id)".', $params));
+    }
+    elseif (count($entities) > 1) {
+      // More helpful error if there are only a few matching entities.
+      $multiples = array();
+      foreach ($entities as $id => $name) {
+        $multiples[] = $name . ' (' . $id . ')';
+      }
+      $params['@id'] = $id;
+      $form_state->setError($element, $this->t('Multiple entities match this reference; "%multiple". Specify the one you want by appending the id in parentheses, like "@value (@id)".', array('%multiple' => implode('", "', $multiples))));
+    }
+    else {
+      // Take the one and only matching entity.
+      return key($entities);
+    }
+  }
+
+}
diff --git a/core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php b/core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php
index eb8b85f..0956896 100644
--- a/core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php
+++ b/core/modules/entity_reference/src/Tests/EntityReferenceAdminTest.php
@@ -9,6 +9,7 @@
 
 use Drupal\Core\Entity\Entity;
 use Drupal\field_ui\Tests\FieldUiTestTrait;
+use Drupal\node\Entity\Node;
 use Drupal\simpletest\WebTestBase;
 use Drupal\taxonomy\Entity\Vocabulary;
 
@@ -247,22 +248,59 @@ public function testFieldAdminHandler() {
     );
     $this->drupalPostForm(NULL, $edit, t('Save settings'));
 
-    // Create a node.
-    $edit = array(
-      'title[0][value]' => 'Foo Node',
-    );
-    $this->drupalPostForm('node/add/' . $this->type, $edit, t('Save'));
+    // Create nodes.
+    $node1 = Node::create([
+      'type' => $this->type,
+      'title' => 'Foo Node',
+    ]);
+    $node1->save();
+    $node2 = Node::create([
+      'type' => $this->type,
+      'title' => 'Foo Node',
+    ]);
+    $node2->save();
 
     // Try to add a new node and fill the entity reference field.
     $this->drupalGet('node/add/' . $this->type);
     $result = $this->xpath('//input[@name="field_test_entity_ref_field[0][target_id]" and contains(@data-autocomplete-path, "/entity_reference_autocomplete/node/views/")]');
     $target_url = $this->getAbsoluteUrl($result[0]['data-autocomplete-path']);
     $this->drupalGet($target_url, array('query' => array('q' => 'Foo')));
-    $this->assertRaw('Foo');
+    $this->assertRaw($node1->getTitle() . ' (' . $node1->id() . ')');
+    $this->assertRaw($node2->getTitle() . ' (' . $node2->id() . ')');
+
+    $edit = array(
+      'title[0][value]' => 'Example',
+      'field_test_entity_ref_field[0][target_id]' => 'Test'
+    );
+    $this->drupalPostForm('node/add/' . $this->type, $edit, t('Save'));
+
+    // Assert that entity reference autocomplete field is validated.
+    $this->assertText(t('1 error has been found: Test Entity Reference Field'), 'Node save failed when required entity reference field was not correctly filled.');
+    $this->assertText(t('There are no entities matching "@entity"', ['@entity' => 'Test']));
+
+    $edit = array(
+      'title[0][value]' => 'Test',
+      'field_test_entity_ref_field[0][target_id]' => $node1->getTitle()
+    );
+    $this->drupalPostForm('node/add/' . $this->type, $edit, t('Save'));
+
+    // Assert the results multiple times to avoid sorting problem of nodes with
+    // the same title.
+    $this->assertText(t('1 error has been found: Test Entity Reference Field'));
+    $this->assertText(t('Multiple entities match this reference;'));
+    $this->assertText(t("@node1", ['@node1' => $node1->getTitle() . ' (' . $node1->id() . ')']));
+    $this->assertText(t("@node2", ['@node2' => $node2->getTitle() . ' (' . $node2->id() . ')']));
+
+    $edit = array(
+      'title[0][value]' => 'Test',
+      'field_test_entity_ref_field[0][target_id]' => $node1->getTitle() . '(' . $node1->id() . ')'
+    );
+    $this->drupalPostForm('node/add/' . $this->type, $edit, t('Save'));
+    $this->assertLink($node1->getTitle());
   }
 
   /**
-   * Tests the formatters for the Entity References
+   * Tests the formatters for the Entity References.
    */
   public function testAvailableFormatters() {
     // Create a new vocabulary.
diff --git a/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php b/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php
index 7b4d424..47a946c 100644
--- a/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php
+++ b/core/modules/views/src/Plugin/EntityReferenceSelection/ViewsSelection.php
@@ -9,6 +9,7 @@
 
 use Drupal\Core\Database\Query\SelectInterface;
 use Drupal\Core\Entity\EntityManagerInterface;
+use Drupal\Core\Entity\Plugin\EntityReferenceSelection\SelectionValidateTrait;
 use Drupal\Core\Extension\ModuleHandlerInterface;
 use Drupal\Core\Form\FormStateInterface;
 use Drupal\Core\Entity\EntityReferenceSelection\SelectionInterface;
@@ -31,6 +32,8 @@
  */
 class ViewsSelection extends PluginBase implements SelectionInterface, ContainerFactoryPluginInterface {
 
+  use SelectionValidateTrait;
+
   /**
    * The entity manager.
    *
@@ -262,13 +265,6 @@ public function validateReferenceableEntities(array $ids) {
   /**
    * {@inheritdoc}
    */
-  public function validateAutocompleteInput($input, &$element, FormStateInterface $form_state, $form, $strict = TRUE) {
-    return NULL;
-  }
-
-  /**
-   * {@inheritdoc}
-   */
   public function entityQueryAlter(SelectInterface $query) {}
 
   /**
