From 22961bb013b5fc491acebcc511540d07590cfce5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20L=C3=B3pez?= <plopesc@gmail.com>
Date: Thu, 27 Mar 2025 19:06:28 +0100
Subject: [PATCH 1/8] Issue #3509310: The AdminToolbar(Navigation) items are
 not clickable when we're on the navigation layout page

---
 .../navigation/src/Form/LayoutForm.php        | 53 +++++++++++++++++--
 .../navigation/src/Hook/NavigationHooks.php   | 23 +-------
 2 files changed, 52 insertions(+), 24 deletions(-)

diff --git a/core/modules/navigation/src/Form/LayoutForm.php b/core/modules/navigation/src/Form/LayoutForm.php
index 51b04c104170..80673ff44fce 100644
--- a/core/modules/navigation/src/Form/LayoutForm.php
+++ b/core/modules/navigation/src/Form/LayoutForm.php
@@ -6,6 +6,7 @@
 
 use Drupal\Core\Form\FormBase;
 use Drupal\Core\Form\FormStateInterface;
+use Drupal\Core\Render\Element;
 use Drupal\Core\StringTranslation\TranslatableMarkup;
 use Drupal\layout_builder\Form\LayoutBuilderEntityFormTrait;
 use Drupal\layout_builder\LayoutTempstoreRepositoryInterface;
@@ -60,24 +61,52 @@ public static function create(ContainerInterface $container): static {
     );
   }
 
+  /**
+   * Handles switching the configuration type selector.
+   */
+  public function addMoreAjax($form, FormStateInterface $form_state) {
+    if ($form_state::hasAnyErrors()) {
+      return $form;
+    }
+
+    $this->handleFormElementsVisibility($form, FALSE);
+    return $form;
+  }
+
   /**
    * {@inheritdoc}
    */
   public function buildForm(array $form, FormStateInterface $form_state, ?SectionStorageInterface $section_storage = NULL) {
+    $form['#prefix'] = '<div id="js-config-form-wrapper">';
+    $form['#suffix'] = '</div>';
     $form['#attributes']['class'][] = 'layout-builder-form';
+    $this->sectionStorage = $section_storage;
+
     $form['layout_builder'] = [
       '#type' => 'layout_builder',
       '#section_storage' => $section_storage,
     ];
     $form['#attached']['library'][] = 'navigation/navigation.layoutBuilder';
 
-    $this->sectionStorage = $section_storage;
     $form['actions'] = [
+      'enable_edition' => [
+        '#name' => 'enable_edition',
+        '#type' => 'submit',
+        '#value' => $this->t('Enable Edit mode'),
+        '#ajax' => [
+          'callback' => '::addMoreAjax',
+          'wrapper' => 'js-config-form-wrapper',
+          'effect' => 'fade',
+        ],
+      ],
       'submit' => [
         '#type' => 'submit',
         '#value' => $this->t('Save'),
       ],
     ] + $this->buildActionsElement([]);
+
+    $this->handleFormElementsVisibility($form);
+
     return $form;
   }
 
@@ -85,8 +114,26 @@ public function buildForm(array $form, FormStateInterface $form_state, ?SectionS
    * {@inheritdoc}
    */
   public function submitForm(array &$form, FormStateInterface $form_state): void {
-    $this->sectionStorage->save();
-    $this->saveTasks($form_state, new TranslatableMarkup('Saved navigation blocks'));
+    $button = $form_state->getTriggeringElement();
+    if ($button['#name'] && $button['#name'] !== 'enable_edition') {
+      $this->sectionStorage->save();
+      $this->saveTasks($form_state, new TranslatableMarkup('Saved navigation blocks'));
+    }
+  }
+
+  /**
+   * Handles visibility of the form elements based on the edit mode status.
+   *
+   * @param array $form
+   *   An associative array containing the structure of the form.
+   */
+  protected function handleFormElementsVisibility(array &$form, $edit_mode_enabled = TRUE): array {
+    foreach (Element::children($form['actions']) as $action) {
+      $edit_action_access = isset($form['actions'][$action]['#name']) && $form['actions'][$action]['#name'] === 'enable_edition';
+      $form['actions'][$action]['#access'] = $edit_mode_enabled ? $edit_action_access : !$edit_action_access;
+    }
+    $form['layout_builder']['#access'] = !$edit_mode_enabled;
+    return $form;
   }
 
 }
diff --git a/core/modules/navigation/src/Hook/NavigationHooks.php b/core/modules/navigation/src/Hook/NavigationHooks.php
index 11bf1773dfe3..673f53255808 100644
--- a/core/modules/navigation/src/Hook/NavigationHooks.php
+++ b/core/modules/navigation/src/Hook/NavigationHooks.php
@@ -31,8 +31,6 @@ class NavigationHooks {
    *   The module handler.
    * @param \Drupal\Core\Session\AccountInterface $currentUser
    *   The current user.
-   * @param \Drupal\Core\Routing\RouteMatchInterface $routeMatch
-   *   The route match.
    * @param \Drupal\navigation\NavigationRenderer $navigationRenderer
    *   The navigation renderer.
    * @param \Drupal\Core\Config\Action\ConfigActionManager $configActionManager
@@ -43,7 +41,6 @@ class NavigationHooks {
   public function __construct(
     protected ModuleHandlerInterface $moduleHandler,
     protected AccountInterface $currentUser,
-    protected RouteMatchInterface $routeMatch,
     protected NavigationRenderer $navigationRenderer,
     #[Autowire('@plugin.manager.config_action')]
     protected ConfigActionManager $configActionManager,
@@ -70,7 +67,7 @@ public function help($route_name, RouteMatchInterface $route_match): ?string {
     }
     if (str_starts_with($route_name, $configuration_route)) {
       $output = '<p>' . $this->t('This layout builder tool allows you to configure the blocks in the navigation toolbar.') . '</p>';
-      $output .= '<p>' . $this->t('Forms and links inside the content of the layout builder tool have been disabled.') . '</p>';
+      $output .= '<p>' . $this->t('Forms and links inside the content of the layout builder tool are disabled in Edit mode.') . '</p>';
       return $output;
     }
     return NULL;
@@ -85,23 +82,7 @@ public function pageTop(array &$page_top): void {
       return;
     }
     $this->navigationRenderer->removeToolbar($page_top);
-    if ($this->routeMatch->getRouteName() !== 'layout_builder.navigation.view') {
-      // Don't render the admin toolbar if in layout edit mode.
-      $this->navigationRenderer->buildNavigation($page_top);
-      $this->navigationRenderer->buildTopBar($page_top);
-      return;
-    }
-    // But if in layout mode, add an empty element to leave space. We need to
-    // use an empty .admin-toolbar element because the css uses the adjacent
-    // sibling selector. The actual rendering of the navigation blocks/layout
-    // occurs in the layout form.
-    $page_top['navigation'] = [
-      '#type' => 'html_tag',
-      '#tag' => 'aside',
-      '#attributes' => [
-        'class' => 'admin-toolbar',
-      ],
-    ];
+    $this->navigationRenderer->buildNavigation($page_top);
     $this->navigationRenderer->buildTopBar($page_top);
   }
 
-- 
GitLab


From 7b0f1ea1c3d9e3f5fbcd186b0520643394841dc9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20L=C3=B3pez?= <plopesc@gmail.com>
Date: Thu, 27 Mar 2025 20:17:51 +0100
Subject: [PATCH 2/8] Issue #3509310: PHPCS & adjustments

---
 .../navigation/src/Form/LayoutForm.php        | 44 ++++++++++++++-----
 1 file changed, 32 insertions(+), 12 deletions(-)

diff --git a/core/modules/navigation/src/Form/LayoutForm.php b/core/modules/navigation/src/Form/LayoutForm.php
index 80673ff44fce..eed3a7670860 100644
--- a/core/modules/navigation/src/Form/LayoutForm.php
+++ b/core/modules/navigation/src/Form/LayoutForm.php
@@ -63,13 +63,16 @@ public static function create(ContainerInterface $container): static {
 
   /**
    * Handles switching the configuration type selector.
+   *
+   * @return array
+   *   An associative array containing the structure of the form.
    */
-  public function addMoreAjax($form, FormStateInterface $form_state) {
+  public function enableEditMode($form, FormStateInterface $form_state): array {
     if ($form_state::hasAnyErrors()) {
       return $form;
     }
 
-    $this->handleFormElementsVisibility($form, FALSE);
+    $this->handleFormElementsVisibility($form);
     return $form;
   }
 
@@ -90,11 +93,11 @@ public function buildForm(array $form, FormStateInterface $form_state, ?SectionS
 
     $form['actions'] = [
       'enable_edition' => [
-        '#name' => 'enable_edition',
         '#type' => 'submit',
         '#value' => $this->t('Enable Edit mode'),
+        '#name' => 'enable_edition',
         '#ajax' => [
-          'callback' => '::addMoreAjax',
+          'callback' => '::enableEditMode',
           'wrapper' => 'js-config-form-wrapper',
           'effect' => 'fade',
         ],
@@ -102,10 +105,11 @@ public function buildForm(array $form, FormStateInterface $form_state, ?SectionS
       'submit' => [
         '#type' => 'submit',
         '#value' => $this->t('Save'),
+        '#name' => 'save',
       ],
     ] + $this->buildActionsElement([]);
 
-    $this->handleFormElementsVisibility($form);
+    $this->handleFormElementsVisibility($form, FALSE);
 
     return $form;
   }
@@ -113,12 +117,26 @@ public function buildForm(array $form, FormStateInterface $form_state, ?SectionS
   /**
    * {@inheritdoc}
    */
-  public function submitForm(array &$form, FormStateInterface $form_state): void {
-    $button = $form_state->getTriggeringElement();
-    if ($button['#name'] && $button['#name'] !== 'enable_edition') {
+  public function submitForm(array &$form, FormStateInterface $form_state) {
+    //$form_state->setRebuild();
+    $user_input = $form_state->getUserInput();
+    if (isset($user_input['save'])) {
+      $this->save($form, $form_state);
+    }
+    $a = 3;
+  }
+
+  /**
+   * Saves the Layout changes.
+   *
+   * @param array $form
+   *   An associative array containing the structure of the form.
+   * @param \Drupal\Core\Form\FormStateInterface $form_state
+   *   The current state of the form.
+   */
+  public function save(array &$form, FormStateInterface $form_state): void {
       $this->sectionStorage->save();
       $this->saveTasks($form_state, new TranslatableMarkup('Saved navigation blocks'));
-    }
   }
 
   /**
@@ -126,13 +144,15 @@ public function submitForm(array &$form, FormStateInterface $form_state): void {
    *
    * @param array $form
    *   An associative array containing the structure of the form.
+   * @param bool $edit_mode_enabled
+   *   Boolean indicating whether the Navigation layout edit mode is enabled.
    */
-  protected function handleFormElementsVisibility(array &$form, $edit_mode_enabled = TRUE): array {
+  protected function handleFormElementsVisibility(array &$form, bool $edit_mode_enabled = TRUE): array {
     foreach (Element::children($form['actions']) as $action) {
       $edit_action_access = isset($form['actions'][$action]['#name']) && $form['actions'][$action]['#name'] === 'enable_edition';
-      $form['actions'][$action]['#access'] = $edit_mode_enabled ? $edit_action_access : !$edit_action_access;
+      $form['actions'][$action]['#access'] = $edit_mode_enabled ? !$edit_action_access : $edit_action_access;
     }
-    $form['layout_builder']['#access'] = !$edit_mode_enabled;
+    $form['layout_builder']['#access'] = $edit_mode_enabled;
     return $form;
   }
 
-- 
GitLab


From c3b802b186e5a9e75671b697d0d42c6d113a7ce2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20L=C3=B3pez?= <plopesc@gmail.com>
Date: Thu, 27 Mar 2025 20:27:31 +0100
Subject: [PATCH 3/8] Issue #3509310: PHPCS

---
 core/modules/navigation/src/Form/LayoutForm.php | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/core/modules/navigation/src/Form/LayoutForm.php b/core/modules/navigation/src/Form/LayoutForm.php
index eed3a7670860..b390c599f7c0 100644
--- a/core/modules/navigation/src/Form/LayoutForm.php
+++ b/core/modules/navigation/src/Form/LayoutForm.php
@@ -117,13 +117,11 @@ public function buildForm(array $form, FormStateInterface $form_state, ?SectionS
   /**
    * {@inheritdoc}
    */
-  public function submitForm(array &$form, FormStateInterface $form_state) {
-    //$form_state->setRebuild();
+  public function submitForm(array &$form, FormStateInterface $form_state): void {
     $user_input = $form_state->getUserInput();
     if (isset($user_input['save'])) {
       $this->save($form, $form_state);
     }
-    $a = 3;
   }
 
   /**
@@ -135,8 +133,8 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
    *   The current state of the form.
    */
   public function save(array &$form, FormStateInterface $form_state): void {
-      $this->sectionStorage->save();
-      $this->saveTasks($form_state, new TranslatableMarkup('Saved navigation blocks'));
+    $this->sectionStorage->save();
+    $this->saveTasks($form_state, new TranslatableMarkup('Saved navigation blocks'));
   }
 
   /**
-- 
GitLab


From 94c29ab870c8b70c1cf1cab4886a08922a591741 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20L=C3=B3pez=20//=20plopesc?= <plopesc@gmail.com>
Date: Tue, 1 Apr 2025 08:16:42 +0200
Subject: [PATCH 4/8] Issue #3509310: Fix tests

---
 core/modules/navigation/src/Form/LayoutForm.php | 13 +++++++++----
 .../NavigationSafeBlockDefinitionTest.php       |  3 +--
 .../NavigationBlockUiTest.php                   | 17 +++++++++++++++--
 3 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/core/modules/navigation/src/Form/LayoutForm.php b/core/modules/navigation/src/Form/LayoutForm.php
index b390c599f7c0..60975cb73b9c 100644
--- a/core/modules/navigation/src/Form/LayoutForm.php
+++ b/core/modules/navigation/src/Form/LayoutForm.php
@@ -146,11 +146,16 @@ public function save(array &$form, FormStateInterface $form_state): void {
    *   Boolean indicating whether the Navigation layout edit mode is enabled.
    */
   protected function handleFormElementsVisibility(array &$form, bool $edit_mode_enabled = TRUE): array {
-    foreach (Element::children($form['actions']) as $action) {
-      $edit_action_access = isset($form['actions'][$action]['#name']) && $form['actions'][$action]['#name'] === 'enable_edition';
-      $form['actions'][$action]['#access'] = $edit_mode_enabled ? !$edit_action_access : $edit_action_access;
-    }
+    // Edit mode elements are visible only in edit mode.
+    $form['actions']['submit']['#access'] =
+    $form['actions']['discard_changes']['#access'] =
+    $form['actions']['preview_toggle']['#access'] =
+    $form['actions']['preview_toggle']['toggle_content_preview']['#access'] =
     $form['layout_builder']['#access'] = $edit_mode_enabled;
+
+    // Edit mode flag element is onl visible when edit mode is disabled.
+    $form['actions']['enable_edition']['#access'] = !$edit_mode_enabled;
+
     return $form;
   }
 
diff --git a/core/modules/navigation/tests/src/Functional/NavigationSafeBlockDefinitionTest.php b/core/modules/navigation/tests/src/Functional/NavigationSafeBlockDefinitionTest.php
index 2f0ab834a27d..3e6bf8756af9 100644
--- a/core/modules/navigation/tests/src/Functional/NavigationSafeBlockDefinitionTest.php
+++ b/core/modules/navigation/tests/src/Functional/NavigationSafeBlockDefinitionTest.php
@@ -51,9 +51,8 @@ protected function setUp(): void {
    */
   public function testNavigationSafeBlockDefinition(): void {
     // Confirm that default blocks are available.
-    $layout_url = '/admin/config/user-interface/navigation-block';
+    $layout_url = '/layout_builder/choose/block/navigation/navigation.block_layout/0/content';
     $this->drupalGet($layout_url);
-    $this->clickLink('Add block');
 
     $this->assertSession()->linkExists('Administration');
     $this->assertSession()->linkExists('Content');
diff --git a/core/modules/navigation/tests/src/FunctionalJavascript/NavigationBlockUiTest.php b/core/modules/navigation/tests/src/FunctionalJavascript/NavigationBlockUiTest.php
index 39ae6026cfb7..42285562570f 100644
--- a/core/modules/navigation/tests/src/FunctionalJavascript/NavigationBlockUiTest.php
+++ b/core/modules/navigation/tests/src/FunctionalJavascript/NavigationBlockUiTest.php
@@ -80,6 +80,8 @@ public function testNavigationBlockAdminUiPageNestedForm(): void {
 
     // Edit the layout and add a block that contains a form.
     $this->drupalGet($layout_url);
+    $this->getSession()->getPage()->pressButton('Enable Edit mode');
+    $this->assertSession()->assertWaitOnAjaxRequest();
     $this->openAddBlockForm('Layout Builder form block test form api form block');
     $this->getSession()->getPage()->checkField('settings[label_display]');
 
@@ -98,6 +100,8 @@ public function testNavigationBlockAdminUiPageNestedForm(): void {
     // Try to save the layout again and confirm it can save because there are no
     // nested form tags.
     $this->drupalGet($layout_url);
+    $this->getSession()->getPage()->pressButton('Enable Edit mode');
+    $this->assertSession()->assertWaitOnAjaxRequest();
     $this->getSession()->getPage()->checkField('toggle_content_preview');
     $this->getSession()->getPage()->pressButton('Save');
     $this->assertSession()->statusMessageNotContains($unexpected_save_message);
@@ -126,6 +130,8 @@ public function testNavigationBlockAdminUiPage(): void {
     $this->drupalLogin($this->adminUser);
     $this->drupalGet($layout_url);
     $page = $this->getSession()->getPage();
+    $this->getSession()->getPage()->pressButton('Enable Edit mode');
+    $this->assertSession()->assertWaitOnAjaxRequest();
 
     // Add section should not be present
     $this->assertSession()->linkNotExists('Add section');
@@ -166,17 +172,24 @@ public function testNavigationBlockAdminUiPage(): void {
     $this->drupalGet($front);
     $this->assertSession()->pageTextNotContains('New Shortcuts');
 
-    // When returning to the layout edit mode, the new block is visible.
+    // When returning to the layout page, the new block is not visible.
     $this->drupalGet($layout_url);
+    $this->assertSession()->pageTextNotContains('New Shortcuts');
+
+    // When returning to the layout edit mode, the new block is visible.
+    $this->getSession()->getPage()->pressButton('Enable Edit mode');
+    $this->assertSession()->assertWaitOnAjaxRequest();
     $this->assertSession()->pageTextContains('New Shortcuts');
 
-    // Save the layout, and the new block is visible.
+    // Save the layout, and the new block is visible in the front page.
     $page->pressButton('Save');
     $this->drupalGet($front);
     $this->assertSession()->pageTextContains('New Shortcuts');
 
     // Reconfigure a block and ensure that the layout content is updated.
     $this->drupalGet($layout_url);
+    $this->getSession()->getPage()->pressButton('Enable Edit mode');
+    $this->assertSession()->assertWaitOnAjaxRequest();
     $this->clickContextualLink('.layout-builder .block-navigation-shortcuts', 'Configure');
     $this->assertOffCanvasFormAfterWait('layout_builder_update_block');
 
-- 
GitLab


From b7442dba3ae934bda787d694983a8348e78d8389 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20L=C3=B3pez=20//=20plopesc?= <plopesc@gmail.com>
Date: Tue, 1 Apr 2025 08:27:23 +0200
Subject: [PATCH 5/8] Issue #3509310: Fix phpcs

---
 core/modules/navigation/src/Form/LayoutForm.php | 1 -
 1 file changed, 1 deletion(-)

diff --git a/core/modules/navigation/src/Form/LayoutForm.php b/core/modules/navigation/src/Form/LayoutForm.php
index 60975cb73b9c..c20af2ce1158 100644
--- a/core/modules/navigation/src/Form/LayoutForm.php
+++ b/core/modules/navigation/src/Form/LayoutForm.php
@@ -6,7 +6,6 @@
 
 use Drupal\Core\Form\FormBase;
 use Drupal\Core\Form\FormStateInterface;
-use Drupal\Core\Render\Element;
 use Drupal\Core\StringTranslation\TranslatableMarkup;
 use Drupal\layout_builder\Form\LayoutBuilderEntityFormTrait;
 use Drupal\layout_builder\LayoutTempstoreRepositoryInterface;
-- 
GitLab


From dbb1ab2a896214898a47cd4da7fe0179e0a65477 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20L=C3=B3pez=20//=20plopesc?= <plopesc@gmail.com>
Date: Tue, 1 Apr 2025 10:06:43 +0200
Subject: [PATCH 6/8] Issue #3509310: Fix related test

---
 .../tests/src/FunctionalJavascript/InlineBlockTest.php          | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php
index 797768d9b590..5fe9449a4767 100644
--- a/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php
+++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php
@@ -597,6 +597,8 @@ public function testAddWorkFlow(): void {
 
     // Confirm that Create Content block opt out logic works for Navigation.
     $this->drupalGet('/admin/config/user-interface/navigation-block');
+    $this->getSession()->getPage()->pressButton('Enable Edit mode');
+    $this->assertSession()->assertWaitOnAjaxRequest();
     $page->clickLink('Add block');
     $assert_session->assertWaitOnAjaxRequest();
     $assert_session->pageTextContains('Choose a block');
-- 
GitLab


From 21c99c4a9f1828b54b64628252dc5f46a431324f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20L=C3=B3pez?=
 <32668-plopesc@users.noreply.drupalcode.org>
Date: Wed, 9 Apr 2025 10:45:19 +0000
Subject: [PATCH 7/8] Apply suggestions.

---
 core/modules/navigation/src/Form/LayoutForm.php        | 10 +++++-----
 .../src/FunctionalJavascript/NavigationBlockUiTest.php |  8 ++++----
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/core/modules/navigation/src/Form/LayoutForm.php b/core/modules/navigation/src/Form/LayoutForm.php
index c20af2ce1158..ab01a70eea1a 100644
--- a/core/modules/navigation/src/Form/LayoutForm.php
+++ b/core/modules/navigation/src/Form/LayoutForm.php
@@ -91,10 +91,10 @@ public function buildForm(array $form, FormStateInterface $form_state, ?SectionS
     $form['#attached']['library'][] = 'navigation/navigation.layoutBuilder';
 
     $form['actions'] = [
-      'enable_edition' => [
+      'enable_edit_mode' => [
         '#type' => 'submit',
-        '#value' => $this->t('Enable Edit mode'),
-        '#name' => 'enable_edition',
+        '#value' => $this->t('Enable edit mode'),
+        '#name' => 'enable_edit_mode',
         '#ajax' => [
           'callback' => '::enableEditMode',
           'wrapper' => 'js-config-form-wrapper',
@@ -152,8 +152,8 @@ protected function handleFormElementsVisibility(array &$form, bool $edit_mode_en
     $form['actions']['preview_toggle']['toggle_content_preview']['#access'] =
     $form['layout_builder']['#access'] = $edit_mode_enabled;
 
-    // Edit mode flag element is onl visible when edit mode is disabled.
-    $form['actions']['enable_edition']['#access'] = !$edit_mode_enabled;
+    // Edit mode flag element is only visible when edit mode is disabled.
+    $form['actions']['enable_edit_mode']['#access'] = !$edit_mode_enabled;
 
     return $form;
   }
diff --git a/core/modules/navigation/tests/src/FunctionalJavascript/NavigationBlockUiTest.php b/core/modules/navigation/tests/src/FunctionalJavascript/NavigationBlockUiTest.php
index 42285562570f..fe1a26703a17 100644
--- a/core/modules/navigation/tests/src/FunctionalJavascript/NavigationBlockUiTest.php
+++ b/core/modules/navigation/tests/src/FunctionalJavascript/NavigationBlockUiTest.php
@@ -80,7 +80,7 @@ public function testNavigationBlockAdminUiPageNestedForm(): void {
 
     // Edit the layout and add a block that contains a form.
     $this->drupalGet($layout_url);
-    $this->getSession()->getPage()->pressButton('Enable Edit mode');
+    $this->getSession()->getPage()->pressButton('Enable edit mode');
     $this->assertSession()->assertWaitOnAjaxRequest();
     $this->openAddBlockForm('Layout Builder form block test form api form block');
     $this->getSession()->getPage()->checkField('settings[label_display]');
@@ -100,7 +100,7 @@ public function testNavigationBlockAdminUiPageNestedForm(): void {
     // Try to save the layout again and confirm it can save because there are no
     // nested form tags.
     $this->drupalGet($layout_url);
-    $this->getSession()->getPage()->pressButton('Enable Edit mode');
+    $this->getSession()->getPage()->pressButton('Enable edit mode');
     $this->assertSession()->assertWaitOnAjaxRequest();
     $this->getSession()->getPage()->checkField('toggle_content_preview');
     $this->getSession()->getPage()->pressButton('Save');
@@ -130,7 +130,7 @@ public function testNavigationBlockAdminUiPage(): void {
     $this->drupalLogin($this->adminUser);
     $this->drupalGet($layout_url);
     $page = $this->getSession()->getPage();
-    $this->getSession()->getPage()->pressButton('Enable Edit mode');
+    $this->getSession()->getPage()->pressButton('Enable edit mode');
     $this->assertSession()->assertWaitOnAjaxRequest();
 
     // Add section should not be present
@@ -188,7 +188,7 @@ public function testNavigationBlockAdminUiPage(): void {
 
     // Reconfigure a block and ensure that the layout content is updated.
     $this->drupalGet($layout_url);
-    $this->getSession()->getPage()->pressButton('Enable Edit mode');
+    $this->getSession()->getPage()->pressButton('Enable edit mode');
     $this->assertSession()->assertWaitOnAjaxRequest();
     $this->clickContextualLink('.layout-builder .block-navigation-shortcuts', 'Configure');
     $this->assertOffCanvasFormAfterWait('layout_builder_update_block');
-- 
GitLab


From b4f2e04993c3082591f7f4d8c14c28c2c63c8af1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pablo=20L=C3=B3pez?=
 <32668-plopesc@users.noreply.drupalcode.org>
Date: Wed, 9 Apr 2025 11:00:49 +0000
Subject: [PATCH 8/8] Apply 2 suggestion(s) to 2 file(s)

---
 .../tests/src/FunctionalJavascript/InlineBlockTest.php          | 2 +-
 .../tests/src/FunctionalJavascript/NavigationBlockUiTest.php    | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php
index 5fe9449a4767..2dcbbf645e5c 100644
--- a/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php
+++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php
@@ -597,7 +597,7 @@ public function testAddWorkFlow(): void {
 
     // Confirm that Create Content block opt out logic works for Navigation.
     $this->drupalGet('/admin/config/user-interface/navigation-block');
-    $this->getSession()->getPage()->pressButton('Enable Edit mode');
+    $this->getSession()->getPage()->pressButton('Enable edit mode');
     $this->assertSession()->assertWaitOnAjaxRequest();
     $page->clickLink('Add block');
     $assert_session->assertWaitOnAjaxRequest();
diff --git a/core/modules/navigation/tests/src/FunctionalJavascript/NavigationBlockUiTest.php b/core/modules/navigation/tests/src/FunctionalJavascript/NavigationBlockUiTest.php
index fe1a26703a17..87d100d40aa7 100644
--- a/core/modules/navigation/tests/src/FunctionalJavascript/NavigationBlockUiTest.php
+++ b/core/modules/navigation/tests/src/FunctionalJavascript/NavigationBlockUiTest.php
@@ -177,7 +177,7 @@ public function testNavigationBlockAdminUiPage(): void {
     $this->assertSession()->pageTextNotContains('New Shortcuts');
 
     // When returning to the layout edit mode, the new block is visible.
-    $this->getSession()->getPage()->pressButton('Enable Edit mode');
+    $this->getSession()->getPage()->pressButton('Enable edit mode');
     $this->assertSession()->assertWaitOnAjaxRequest();
     $this->assertSession()->pageTextContains('New Shortcuts');
 
-- 
GitLab