Change record status: 
Project: 
Introduced in branch: 
11.4.x
Introduced in version: 
11.4.0
Description: 

The attributes of a block content render array, in a #attributes key, are merged into the content's wrapper.

To apply attributes to the entire block, set the attributes in the render array #wrapper_attributes key instead.

Previously, if a block's content render array contained an #attributes key, then those attributes would be merged into the <div> wrapper for the entire block.

Example

Given a render array like:

return [
  '#attributes' => [
    'class' => [
      'foo'
    ],
    'data-content-custom' => 'bar',
  ],
  '#wrapper_attributes' => [
    'data-wrapper-custom' => 'baz',
  ],
  '#markup' => 'Sample content',
];

Before

<div id="block-foobartest" class="foo" data-content-custom="bar" data-wrapper-custom="baz">
  <div class="content">
    Sample content.
  </div>
</div>

After

<div id="block-foobartest" data-wrapper-custom="baz">
  <div class="content foo" data-content-custom="bar">
    Sample content.
  </div>
</div>
Impacts: 
Module developers
Themers