diff --git a/core/modules/layout_builder/src/Element/LayoutBuilder.php b/core/modules/layout_builder/src/Element/LayoutBuilder.php index 37042f761abe5dca0dc423fec7fca5aac597f8c9..e53819611af132df6b8784ba7f871d02fdc54c05 100644 --- a/core/modules/layout_builder/src/Element/LayoutBuilder.php +++ b/core/modules/layout_builder/src/Element/LayoutBuilder.php @@ -285,6 +285,11 @@ protected function buildAdministrativeSection(SectionStorageInterface $section_s $build[$region]['layout_builder_add_block']['#weight'] = 1000; $build[$region]['#attributes']['data-region'] = $region; $build[$region]['#attributes']['class'][] = 'layout-builder__region'; + $build[$region]['#attributes']['role'] = 'group'; + $build[$region]['#attributes']['aria-label'] = $this->t('@region region in section @section', [ + '@region' => $info['label'], + '@section' => $delta + 1, + ]); } $build['#attributes']['data-layout-update-url'] = Url::fromRoute('layout_builder.move_block', [ @@ -298,6 +303,8 @@ protected function buildAdministrativeSection(SectionStorageInterface $section_s '#type' => 'container', '#attributes' => [ 'class' => ['layout-builder__section'], + 'role' => 'group', + 'aria-label' => $this->t('Section @section', ['@section' => $delta + 1]), ], 'remove' => [ '#type' => 'link', diff --git a/core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php b/core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php index 5b41c3fcfca988353e204d316484458cb47d8184..7ce0e80ae7b325b6de9fb112cf78b458cf2e982a 100644 --- a/core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php +++ b/core/modules/layout_builder/tests/src/Functional/LayoutBuilderTest.php @@ -328,6 +328,16 @@ public function testLayoutBuilderUi() { $this->drupalGet("$field_ui_prefix/display/default/layout"); $assert_session->pageTextNotContains('My text field'); $assert_session->elementNotExists('css', '.field--name-field-my-text'); + + $expected_labels = [ + 'Section 1', + 'Content region in section 1', + ]; + $labels = []; + foreach ($page->findAll('css', '[role="group"]') as $element) { + $labels[] = $element->getAttribute('aria-label'); + } + $this->assertSame($expected_labels, $labels); } /**