Commit 9985cc04 authored by xjm's avatar xjm

Issue #3041143 by tim.plunkett, cboyden, xjm, phenaproxima, rainbreaw: Add...

Issue #3041143 by tim.plunkett, cboyden, xjm, phenaproxima, rainbreaw: Add ARIA group roles to Layout Builder UI
parent e59ec93f
......@@ -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',
......
......@@ -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);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment