From 3de7cd3b1e5d8779f6469465e70c8497a01836a4 Mon Sep 17 00:00:00 2001 From: bnjmnm Date: Wed, 10 May 2023 07:32:46 -0400 Subject: [PATCH] Issue #3087950 by Utkarsh_33, swatichouhan012, komalk, Sivaji_Ganesh_Jojodae, Therapychild, Sakthivel M, lauriii, thalles, shalinigaur, kostyashupenko, fhaeberle, amjad1233, sibustephen, pankaj.singh, KondratievaS, pranav.aeer, hooroomoo, ckrina, huzooka: Progress throbber position is incorrect --- core/misc/ajax.js | 8 +++++++- .../templates/dropbutton-wrapper.html.twig | 2 +- .../src/Kernel/Plugin/RowRenderCacheTest.php | 2 +- .../Ajax/ThrobberTest.php | 18 ++++++++++++++++++ .../form/dropbutton-wrapper.html.twig | 2 +- .../form/dropbutton-wrapper.html.twig | 2 +- 6 files changed, 29 insertions(+), 5 deletions(-) diff --git a/core/misc/ajax.js b/core/misc/ajax.js index 54ec6cdcf13..739c67046d3 100644 --- a/core/misc/ajax.js +++ b/core/misc/ajax.js @@ -991,7 +991,13 @@ this.progress.element = $( Drupal.theme('ajaxProgressThrobber', this.progress.message), ); - $(this.element).after(this.progress.element); + if ($(this.element).closest('[data-drupal-ajax-container]').length) { + $(this.element) + .closest('[data-drupal-ajax-container]') + .after(this.progress.element); + } else { + $(this.element).after(this.progress.element); + } }; /** diff --git a/core/modules/system/templates/dropbutton-wrapper.html.twig b/core/modules/system/templates/dropbutton-wrapper.html.twig index 62d2ef200d4..9c87a49f6b8 100644 --- a/core/modules/system/templates/dropbutton-wrapper.html.twig +++ b/core/modules/system/templates/dropbutton-wrapper.html.twig @@ -13,7 +13,7 @@ #} {% if children %} {% apply spaceless %} -
+
{{ children }}
diff --git a/core/modules/views/tests/src/Kernel/Plugin/RowRenderCacheTest.php b/core/modules/views/tests/src/Kernel/Plugin/RowRenderCacheTest.php index 2eac087cdf5..5b153880443 100644 --- a/core/modules/views/tests/src/Kernel/Plugin/RowRenderCacheTest.php +++ b/core/modules/views/tests/src/Kernel/Plugin/RowRenderCacheTest.php @@ -179,7 +179,7 @@ class RowRenderCacheTest extends ViewsKernelTestBase { $expected = $access ? "delete" : ""; $output = $view->style_plugin->getField($index, 'delete_node'); $this->assertSame($expected, (string) $output); - $expected = $access ? '
    ' . + $expected = $access ? '
    ' : ''; diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php index 11451559f30..eb66398b572 100644 --- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php +++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/ThrobberTest.php @@ -20,6 +20,7 @@ class ThrobberTest extends WebDriverTestBase { 'views_ui', 'views_ui_test_field', 'hold_test', + 'block', ]; /** @@ -93,4 +94,21 @@ JS; $web_assert->assertNoElementAfterWait('css', '.custom-ajax-progress-throbber'); } + /** + * Tests progress throbber element position. + */ + public function testProgressThrobberPosition() { + $this->drupalLogin($this->rootUser); + + $this->drupalGet('/admin/structure/block'); + $this->clickLink('Place block'); + hold_test_response(FALSE); + $this->assertSession()->waitForText('Place Block'); + $this->clickLink('Place block'); + hold_test_response(TRUE); + $this->assertSession()->elementExists('xpath', '//div[contains(@class, "dropbutton-wrapper")]/following-sibling::div[contains(@class, "ajax-progress-throbber")]'); + hold_test_response(FALSE); + $this->assertSession()->assertNoElementAfterWait('css', '.ajax-progress-throbber'); + } + } diff --git a/core/themes/stable9/templates/form/dropbutton-wrapper.html.twig b/core/themes/stable9/templates/form/dropbutton-wrapper.html.twig index a2bdc21d674..930e6ef6074 100644 --- a/core/themes/stable9/templates/form/dropbutton-wrapper.html.twig +++ b/core/themes/stable9/templates/form/dropbutton-wrapper.html.twig @@ -11,7 +11,7 @@ #} {% if children %} {% apply spaceless %} -
    +
    {{ children }}
    diff --git a/core/themes/starterkit_theme/templates/form/dropbutton-wrapper.html.twig b/core/themes/starterkit_theme/templates/form/dropbutton-wrapper.html.twig index a2bdc21d674..930e6ef6074 100644 --- a/core/themes/starterkit_theme/templates/form/dropbutton-wrapper.html.twig +++ b/core/themes/starterkit_theme/templates/form/dropbutton-wrapper.html.twig @@ -11,7 +11,7 @@ #} {% if children %} {% apply spaceless %} -
    +
    {{ children }}