diff --git a/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php b/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php
index e481384..2622304 100644
--- a/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php
+++ b/core/modules/file/lib/Drupal/file/Tests/FileFieldWidgetTest.php
@@ -30,6 +30,39 @@ public static function getInfo() {
   }
 
   /**
+   * Tests that files are not deleted when attached to a form with #access = hidden.
+   */
+  function testFileSaveAccessHidden() {
+    $node_controller = $this->container->get('plugin.manager.entity')->getStorageController('node');
+    $file_controller = $this->container->get('plugin.manager.entity')->getStorageController('file');
+
+    // Add a file field to the test content type.
+    $type = $this->drupalCreateContentType();
+    $field_name = 'hidden_file_field';
+    $this->createFileField($field_name, $type->name);
+    $field = $this->container->get('field.info')->getField($field_name);
+    $instance = $this->container->get('field.info')->getInstance('node', $field_name, $type->name);
+
+    // Create a node with an uploaded file in the field.
+    $test_file = $this->getTestFile('text');
+    $nid = $this->uploadNodeFile($test_file, $field_name, $type->name);
+
+    // Hide file field by enabling helper module.
+    $this->container->get('module_handler')->enable(array('file_test_hidden'));
+
+    // Save the node and ensure the file is not deleted.
+    $this->drupalPost("node/$nid/edit", array(), t('Save and keep published'));
+    $node_controller->resetCache(array($nid));
+    $node = $node_controller->load($nid, TRUE)->getNGEntity();
+
+    $node_file = $file_controller->load($node->{$field_name}->target_id);
+    $this->assertFileExists($node_file, 'File still exists.');
+
+    // Disable helper module.
+    $this->container->get('module_handler')->disable(array('file_test_hidden'));
+  }
+
+  /**
    * Tests upload and remove buttons for a single-valued File field.
    */
   function testSingleValuedWidget() {
diff --git a/core/modules/file/tests/modules/file_test_hidden/file_test_hidden.info.yml b/core/modules/file/tests/modules/file_test_hidden/file_test_hidden.info.yml
new file mode 100644
index 0000000..b808055
--- /dev/null
+++ b/core/modules/file/tests/modules/file_test_hidden/file_test_hidden.info.yml
@@ -0,0 +1,7 @@
+name: 'File test hidden form element'
+type: module
+description: 'Provides alter hook to test if hidden form elements funciton properly.'
+package: Testing
+version: VERSION
+core: 8.x
+hidden: true
diff --git a/core/modules/file/tests/modules/file_test_hidden/file_test_hidden.module b/core/modules/file/tests/modules/file_test_hidden/file_test_hidden.module
new file mode 100644
index 0000000..5abfdbf
--- /dev/null
+++ b/core/modules/file/tests/modules/file_test_hidden/file_test_hidden.module
@@ -0,0 +1,11 @@
+<?php
+
+
+/**
+ * Implements hook_form_alter().
+ *
+ * @see FileFieldWidgetTest::testFileSaveAccessHidden().
+ */
+function file_test_hidden_form_alter(&$form) {
+  $form['hidden_file_field']['#access'] = FALSE;
+}
