From 396a1670ccff349d6a1a36b605dd20eab8bca957 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20L=C3=B3pez=20//=20plopesc?= <plopesc@gmail.com> Date: Fri, 21 Feb 2025 10:03:05 +0100 Subject: [PATCH 1/5] Issue #3508199: Navigation Top Bar accessibility issues found by Nightwatch tests --- core/modules/navigation/src/NavigationRenderer.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/core/modules/navigation/src/NavigationRenderer.php b/core/modules/navigation/src/NavigationRenderer.php index fe8792bc4926..dfb9dd7cc779 100644 --- a/core/modules/navigation/src/NavigationRenderer.php +++ b/core/modules/navigation/src/NavigationRenderer.php @@ -204,10 +204,6 @@ protected function getContentTop(): array { * @see hook_page_top() */ public function buildTopBar(array &$page_top): void { - if (!$this->moduleHandler->moduleExists('navigation_top_bar')) { - return; - } - $page_top['top_bar'] = [ '#type' => 'top_bar', '#access' => $this->currentUser->hasPermission('access navigation'), @@ -236,7 +232,7 @@ public function removeLocalTasks(array &$build, BlockPluginInterface $block): vo if ($block->getPluginId() !== 'local_tasks_block') { return; } - if ($this->hasLocalTasks() && $this->moduleHandler->moduleExists('navigation_top_bar')) { + if ($this->hasLocalTasks()) { $build['#access'] = FALSE; } } -- GitLab From 256cfaf715b43cb3157ae4192352f038d4740475 Mon Sep 17 00:00:00 2001 From: iberdinsky-skilld <iberdinsky@skilld.cloud> Date: Sat, 22 Feb 2025 12:55:56 +0100 Subject: [PATCH 2/5] Added a11y fixes --- .../modules/navigation/templates/top-bar-page-actions.html.twig | 1 + core/modules/navigation/templates/top-bar.html.twig | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/modules/navigation/templates/top-bar-page-actions.html.twig b/core/modules/navigation/templates/top-bar-page-actions.html.twig index c98e8d6a3e08..2fb8edce6100 100644 --- a/core/modules/navigation/templates/top-bar-page-actions.html.twig +++ b/core/modules/navigation/templates/top-bar-page-actions.html.twig @@ -23,6 +23,7 @@ {% include 'navigation:toolbar-button' with { icon: 'dots', + action: 'More actions'|t, attributes: create_attribute( { 'aria-expanded': 'false', diff --git a/core/modules/navigation/templates/top-bar.html.twig b/core/modules/navigation/templates/top-bar.html.twig index b294ecfaf206..0cbdc69c4643 100644 --- a/core/modules/navigation/templates/top-bar.html.twig +++ b/core/modules/navigation/templates/top-bar.html.twig @@ -13,7 +13,7 @@ */ #} {% set attributes = create_attribute() %} -<div {{ attributes.addClass('top-bar').setAttribute('data-drupal-admin-styles', '') }}> +<div {{ attributes.addClass('top-bar').setAttribute('data-drupal-admin-styles', '').setAttribute('role', 'navigation') }}> <div class="top-bar__content"> <div class="top-bar__tools"> {{- tools -}} -- GitLab From f738dde6aca3ab987292be61199d72a954dd7108 Mon Sep 17 00:00:00 2001 From: Matthew Oliveira <m4olivei@gmail.com> Date: Mon, 24 Feb 2025 15:48:40 -0500 Subject: [PATCH 3/5] Issue #3508199: Accessibility work to identify the top bar --- core/modules/navigation/templates/top-bar.html.twig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/modules/navigation/templates/top-bar.html.twig b/core/modules/navigation/templates/top-bar.html.twig index 0cbdc69c4643..ff39bc75ebad 100644 --- a/core/modules/navigation/templates/top-bar.html.twig +++ b/core/modules/navigation/templates/top-bar.html.twig @@ -13,7 +13,8 @@ */ #} {% set attributes = create_attribute() %} -<div {{ attributes.addClass('top-bar').setAttribute('data-drupal-admin-styles', '').setAttribute('role', 'navigation') }}> +<aside {{ attributes.addClass('top-bar').setAttribute('data-drupal-admin-styles', '').setAttribute('aria-labeledby', 'top-bar__title') }}> + <h3 id="top-bar__title" class="visually-hidden">{{ 'Administrative top bar'|t }}</h3> <div class="top-bar__content"> <div class="top-bar__tools"> {{- tools -}} @@ -25,4 +26,4 @@ {{- actions -}} </div> </div> -</div> +</aside> -- GitLab From ed254e66b96659d9464d16747c5e5be02cd0a4dc Mon Sep 17 00:00:00 2001 From: Matthew Oliveira <m4olivei@gmail.com> Date: Tue, 25 Feb 2025 08:20:15 -0500 Subject: [PATCH 4/5] Issue #3508199: Fix aria-labelledby spelling --- core/modules/navigation/templates/top-bar.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/modules/navigation/templates/top-bar.html.twig b/core/modules/navigation/templates/top-bar.html.twig index ff39bc75ebad..6efdeed523f9 100644 --- a/core/modules/navigation/templates/top-bar.html.twig +++ b/core/modules/navigation/templates/top-bar.html.twig @@ -13,7 +13,7 @@ */ #} {% set attributes = create_attribute() %} -<aside {{ attributes.addClass('top-bar').setAttribute('data-drupal-admin-styles', '').setAttribute('aria-labeledby', 'top-bar__title') }}> +<aside {{ attributes.addClass('top-bar').setAttribute('data-drupal-admin-styles', '').setAttribute('aria-labelledby', 'top-bar__title') }}> <h3 id="top-bar__title" class="visually-hidden">{{ 'Administrative top bar'|t }}</h3> <div class="top-bar__content"> <div class="top-bar__tools"> -- GitLab From a0a12156d97037e83861b891e381b9c1707b92c3 Mon Sep 17 00:00:00 2001 From: Matthew Oliveira <m4olivei@gmail.com> Date: Thu, 27 Feb 2025 21:47:53 -0500 Subject: [PATCH 5/5] Revert "Issue #3508199: Navigation Top Bar accessibility issues found by Nightwatch tests" This reverts commit 396a1670ccff349d6a1a36b605dd20eab8bca957. --- core/modules/navigation/src/NavigationRenderer.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/modules/navigation/src/NavigationRenderer.php b/core/modules/navigation/src/NavigationRenderer.php index dfb9dd7cc779..fe8792bc4926 100644 --- a/core/modules/navigation/src/NavigationRenderer.php +++ b/core/modules/navigation/src/NavigationRenderer.php @@ -204,6 +204,10 @@ protected function getContentTop(): array { * @see hook_page_top() */ public function buildTopBar(array &$page_top): void { + if (!$this->moduleHandler->moduleExists('navigation_top_bar')) { + return; + } + $page_top['top_bar'] = [ '#type' => 'top_bar', '#access' => $this->currentUser->hasPermission('access navigation'), @@ -232,7 +236,7 @@ public function removeLocalTasks(array &$build, BlockPluginInterface $block): vo if ($block->getPluginId() !== 'local_tasks_block') { return; } - if ($this->hasLocalTasks()) { + if ($this->hasLocalTasks() && $this->moduleHandler->moduleExists('navigation_top_bar')) { $build['#access'] = FALSE; } } -- GitLab