Loading core/misc/dialog/dialog.js +1 −1 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ function closeDialog(value) { $(window).trigger('dialog:beforeclose', [dialog, $element]); // Unlocks the body when the dialog closes. bodyScrollLock.unlock($element.get(0)); bodyScrollLock.clearBodyLocks(); $element.dialog('close'); dialog.returnValue = value; Loading core/modules/views_ui/js/dialog.views.js +0 −17 Original line number Diff line number Diff line Loading @@ -88,21 +88,4 @@ bodyScrollLock.lock($scroll.get(0)); } }); /** * Binds a listener on dialog close to handle Views modal scroll. * * @param {jQuery.Event} e * The event triggered. * @param {Drupal.dialog~dialogDefinition} dialog * The dialog instance. * @param {jQuery} $element * The jQuery collection of the dialog element. */ $(window).on('dialog:beforeclose', (e, dialog, $element) => { const $scroll = $element.find('.scroll'); if ($scroll.length) { bodyScrollLock.unlock($scroll.get(0)); } }); })(jQuery, Drupal, drupalSettings, bodyScrollLock); core/modules/views_ui/tests/src/FunctionalJavascript/AdminAjaxTest.php +22 −0 Original line number Diff line number Diff line Loading @@ -59,4 +59,26 @@ public function testAjaxRebuild() { $assert_session->pageTextContains('This is text added to the display edit form'); } /** * Tests body scroll. */ public function testBodyScroll() { $this->drupalGet('admin/structure/views/view/user_admin_people'); $page = $this->getSession()->getPage(); foreach (['name[views.nothing]', 'name[views.dropbutton]'] as $field) { $page->find('css', '#views-add-field')->click(); $this->assertSession()->assertWaitOnAjaxRequest(); $page->checkField($field); $this->assertSession()->assertWaitOnAjaxRequest(); $page->find('css', '.ui-dialog-buttonset')->pressButton('Add and configure fields'); $this->assertSession()->assertWaitOnAjaxRequest(); $this->assertJsCondition('document.documentElement.style.overflow === "hidden"'); $page->find('css', '.ui-dialog-buttonset')->pressButton('Apply'); $this->assertSession()->assertWaitOnAjaxRequest(); // Check overflow. $this->assertJsCondition('document.documentElement.style.overflow !== "hidden"'); } } } Loading
core/misc/dialog/dialog.js +1 −1 Original line number Diff line number Diff line Loading @@ -86,7 +86,7 @@ function closeDialog(value) { $(window).trigger('dialog:beforeclose', [dialog, $element]); // Unlocks the body when the dialog closes. bodyScrollLock.unlock($element.get(0)); bodyScrollLock.clearBodyLocks(); $element.dialog('close'); dialog.returnValue = value; Loading
core/modules/views_ui/js/dialog.views.js +0 −17 Original line number Diff line number Diff line Loading @@ -88,21 +88,4 @@ bodyScrollLock.lock($scroll.get(0)); } }); /** * Binds a listener on dialog close to handle Views modal scroll. * * @param {jQuery.Event} e * The event triggered. * @param {Drupal.dialog~dialogDefinition} dialog * The dialog instance. * @param {jQuery} $element * The jQuery collection of the dialog element. */ $(window).on('dialog:beforeclose', (e, dialog, $element) => { const $scroll = $element.find('.scroll'); if ($scroll.length) { bodyScrollLock.unlock($scroll.get(0)); } }); })(jQuery, Drupal, drupalSettings, bodyScrollLock);
core/modules/views_ui/tests/src/FunctionalJavascript/AdminAjaxTest.php +22 −0 Original line number Diff line number Diff line Loading @@ -59,4 +59,26 @@ public function testAjaxRebuild() { $assert_session->pageTextContains('This is text added to the display edit form'); } /** * Tests body scroll. */ public function testBodyScroll() { $this->drupalGet('admin/structure/views/view/user_admin_people'); $page = $this->getSession()->getPage(); foreach (['name[views.nothing]', 'name[views.dropbutton]'] as $field) { $page->find('css', '#views-add-field')->click(); $this->assertSession()->assertWaitOnAjaxRequest(); $page->checkField($field); $this->assertSession()->assertWaitOnAjaxRequest(); $page->find('css', '.ui-dialog-buttonset')->pressButton('Add and configure fields'); $this->assertSession()->assertWaitOnAjaxRequest(); $this->assertJsCondition('document.documentElement.style.overflow === "hidden"'); $page->find('css', '.ui-dialog-buttonset')->pressButton('Apply'); $this->assertSession()->assertWaitOnAjaxRequest(); // Check overflow. $this->assertJsCondition('document.documentElement.style.overflow !== "hidden"'); } } }