diff --git a/core/modules/block/tests/src/Traits/BlockCreationTrait.php b/core/modules/block/tests/src/Traits/BlockCreationTrait.php index fe0a379..0ecaebd 100644 --- a/core/modules/block/tests/src/Traits/BlockCreationTrait.php +++ b/core/modules/block/tests/src/Traits/BlockCreationTrait.php @@ -3,6 +3,7 @@ namespace Drupal\Tests\block\Traits; use Drupal\block\Entity\Block; +use Drupal\Core\Block\BlockPluginInterface; /** * Provides methods to create and place block with default settings. @@ -46,6 +47,7 @@ protected function placeBlock($plugin_id, array $settings = []) { 'id' => strtolower($this->randomMachineName(8)), 'theme' => $config->get('system.theme')->get('default'), 'label' => $this->randomMachineName(8), + 'label_display' => BlockPluginInterface::BLOCK_LABEL_VISIBLE, 'visibility' => [], 'weight' => 0, ]; diff --git a/core/modules/settings_tray/src/Block/BlockEntityOffCanvasForm.php b/core/modules/settings_tray/src/Block/BlockEntityOffCanvasForm.php index 2c6f80d..4bc9df4 100644 --- a/core/modules/settings_tray/src/Block/BlockEntityOffCanvasForm.php +++ b/core/modules/settings_tray/src/Block/BlockEntityOffCanvasForm.php @@ -60,10 +60,11 @@ public function form(array $form, FormStateInterface $form_state) { unset($form['id'], $form['region'], $form['settings']['admin_label']); if (isset($form['settings']['label_display']) && isset($form['settings']['label'])) { - // Only show the label input if the label will be shown on the page. + // Only show the label input if the label will be shown on the page or + // visually hidden for screen readers. $form['settings']['label_display']['#weight'] = -100; - $form['settings']['label']['#states']['visible'] = [ - ':input[name="settings[label_display]"]' => ['checked' => TRUE], + $form['settings']['label']['#states']['invisible'] = [ + ':input[name="settings[label_display]"]' => ['value' => 0], ]; // Relabel to "Block title" because on the front-end this may be confused