diff --git a/core/modules/views/lib/Drupal/views/Plugin/views/display/Attachment.php b/core/modules/views/lib/Drupal/views/Plugin/views/display/Attachment.php
index cfd03a5ad4d188320bd4512f08c78def4345ebdb..95c2291aca612d8a51c9f6b84f5d4bc44db9bc66 100644
--- a/core/modules/views/lib/Drupal/views/Plugin/views/display/Attachment.php
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/display/Attachment.php
@@ -91,8 +91,8 @@ public function optionsSummary(&$categories, &$options) {
     }
     elseif (count($displays) == 1) {
       $display = array_shift($displays);
-      if (!empty($this->view->display[$display])) {
-        $attach_to = check_plain($this->view->display[$display]['display_title']);
+      if (!empty($this->view->storage->display[$display])) {
+        $attach_to = check_plain($this->view->storage->display[$display]['display_title']);
       }
     }
 
@@ -194,7 +194,7 @@ public function buildOptionsForm(&$form, &$form_state) {
       case 'displays':
         $form['#title'] .= t('Attach to');
         $displays = array();
-        foreach ($this->view->display as $display_id => $display) {
+        foreach ($this->view->storage->get('display') as $display_id => $display) {
           if (!empty($this->view->displayHandlers[$display_id]) && $this->view->displayHandlers[$display_id]->acceptAttachments()) {
             $displays[$display_id] = $display['display_title'];
           }
@@ -246,8 +246,8 @@ public function attachTo(ViewExecutable $view, $display_id) {
     $view->setArguments($args);
     $view->setDisplay($this->display['id']);
     if ($this->getOption('inherit_pager')) {
-      $view->display_handler->usesPager = $this->view->display[$display_id]->handler->usesPager();
-      $view->display_handler->setOption('pager', $this->view->display[$display_id]->handler->getOption('pager'));
+      $view->display_handler->usesPager = $this->view->displayHandlers[$display_id]->usesPager();
+      $view->display_handler->setOption('pager', $this->view->displayHandlers[$display_id]->getOption('pager'));
     }
 
     $attachment = $view->executeDisplay($this->display['id'], $args);
diff --git a/core/modules/views/lib/Drupal/views/Tests/UI/DisplayAttachmentTest.php b/core/modules/views/lib/Drupal/views/Tests/UI/DisplayAttachmentTest.php
new file mode 100644
index 0000000000000000000000000000000000000000..0f26c3f6966fdc5591eb949073d0df72cedbe0e5
--- /dev/null
+++ b/core/modules/views/lib/Drupal/views/Tests/UI/DisplayAttachmentTest.php
@@ -0,0 +1,53 @@
+<?php
+
+  /**
+   * @file
+   * Contains \Drupal\views\Tests\UI\DisplayAttachmentTest.
+   */
+
+namespace Drupal\views\Tests\UI;
+
+/**
+ * Tests the UI for the attachment display plugin.
+ *
+ * @see Drupal\views\Plugin\views\display\Attachment
+ */
+class DisplayAttachmentTest extends UITestBase {
+
+  /**
+   * Views used by this test.
+   *
+   * @var array
+   */
+  public static $testViews = array('test_attachment_ui');
+
+  public static function getInfo() {
+    return array(
+      'name' => 'Display: Attachment',
+      'description' => 'Tests the UI for the attachment display plugin.',
+      'group' => 'Views UI',
+    );
+  }
+
+  /**
+   * Tests the attachment UI.
+   */
+  public function testAttachmentUI() {
+    $this->drupalGet('admin/structure/views/view/test_attachment_ui/edit/attachment_1');
+    $this->assertText(t('Not defined'), 'The right text appears if there is no attachment selection yet.');
+
+    $this->drupalGet('admin/structure/views/nojs/display/test_attachment_ui/attachment_1/displays');
+
+    foreach (array('default', 'page-1') as $display_id) {
+      $this->assertNoFieldChecked("edit-displays-$display_id", format_string('Make sure the @display_id can be marked as attached', array('@display_id' => $display_id)));
+    }
+
+    // Save the attachments and test the value on the view.
+    $this->drupalPost(NULL, array('displays[default]' => 1, 'displays[page_1]' => 1), t('Apply'));
+    $this->drupalPost(NULL, array(), t('Save'));
+
+    $view = views_get_view('test_attachment_ui');
+    $view->initDisplay();
+    $this->assertEqual(array_keys($view->displayHandlers['attachment_1']->getOption('displays')), array('default', 'page_1'), 'The attached displays got saved as expected');
+  }
+}
diff --git a/core/modules/views/tests/views_test_config/test_views/views.view.test_attachment_ui.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_attachment_ui.yml
new file mode 100644
index 0000000000000000000000000000000000000000..3d3702e4a5b037ab307215afcc3cd2293c001ab1
--- /dev/null
+++ b/core/modules/views/tests/views_test_config/test_views/views.view.test_attachment_ui.yml
@@ -0,0 +1,68 @@
+api_version: '3.0'
+base_table: views_test_data
+core: '8'
+description: ''
+disabled: '0'
+display:
+  default:
+    display_options:
+      access:
+        type: perm
+        options:
+          perm: 'views_test_data test permission'
+      cache:
+        type: none
+      exposed_form:
+        type: basic
+      pager:
+        type: full
+      style:
+        type: default
+      row:
+        type: fields
+      fields:
+        id:
+          id: id
+          table: views_test_data
+          field: id
+    display_plugin: default
+    display_title: Master
+    id: default
+    position: '0'
+  attachment_1:
+    display_plugin: attachment
+    display_title: Attachment
+    id: attachment_1
+    position: '1'
+  page_1:
+    display_plugin: page
+    display_title: Page
+    display_options:
+      path: test_attachment_ui
+    id: page_1
+    position: '2'
+  feed_1:
+    display_plugin: feed
+    id: feed_1
+    display_title: Feed
+    position: ''
+    display_options:
+      pager:
+        type: some
+      style:
+        type: rss
+      row:
+        type: rss_fields
+        options:
+          title_field: id
+          link_field: id
+          description_field: id
+          creator_field: id
+          date_field: id
+          guid_field_options:
+            guid_field: id
+            guid_field_is_permalink: '0'
+      path: test_attachment_ui_feed
+    position: '3'
+name: test_attachment_ui
+tag: ''