Skip to content
Snippets Groups Projects
Commit 5adef510 authored by Jess's avatar Jess
Browse files

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

(cherry picked from commit 9985cc04)
parent b2f88e3a
No related branches found
No related tags found
No related merge requests found
......@@ -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);
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment