diff --git a/core/modules/block/block.module b/core/modules/block/block.module
index dd3aa6f..8e23de2 100644
--- a/core/modules/block/block.module
+++ b/core/modules/block/block.module
@@ -243,6 +243,21 @@ function _block_get_renderable_region($list = array()) {
         unset($build[$key]['content']['#contextual_links']);
       }
     }
+
+    // Just as with contextual links above, move attributes of the content
+    // element to the top level. This allows attributes that are intended to
+    // work in tandem with contextual links (e.g., ones provided by Edit module)
+    // to function. We assume here that this does not cause problems for other
+    // attributes (e.g., ones provided for semantic purposes), since the way
+    // blocks are partitioned into the top-level element and a 'content'
+    // subelement is an implementation artifact.
+    if (isset($build[$key]['content']['#attributes'])) {
+      if (!isset($build[$key]['#attributes'])) {
+        $build[$key]['#attributes'] = array();
+      }
+      $build[$key]['#attributes'] = NestedArray::mergeDeep($build[$key]['#attributes'], $build[$key]['content']['#attributes']);
+      unset($build[$key]['content']['#attributes']);
+    }
   }
   return $build;
 }
@@ -487,16 +502,6 @@ function template_preprocess_block(&$variables) {
   $variables['attributes']['class'][] = 'block';
   $variables['attributes']['class'][] = drupal_html_class('block-' . $variables['configuration']['module']);
 
-  // The block template provides a wrapping element for the content. Render the
-  // #attributes of the content on this wrapping element rather than passing
-  // them through to the content's #theme function/template. This allows the
-  // content to not require a function/template at all, or if it does use one,
-  // to not require it to output an extra wrapping element.
-  if (isset($variables['content']['#attributes'])) {
-    $variables['content_attributes'] = NestedArray::mergeDeep($variables['content_attributes'], $variables['content']['#attributes']);
-    unset($variables['content']['#attributes']);
-  }
-
   // Add default class for block content.
   $variables['content_attributes']['class'][] = 'content';
 
