From 44bc1e4101d727f97cbce9b39a59dec3fa4d39a7 Mon Sep 17 00:00:00 2001
From: webchick <drupal@webchick.net>
Date: Mon, 17 Jul 2017 12:31:48 -0700
Subject: [PATCH] Issue #2888305 by drpal, tedbow: In Settings Tray the when
 form is longer than page body it is tricky to scroll to the very bottom

---
 core/modules/outside_in/js/off-canvas.es6.js | 4 ++++
 core/modules/outside_in/js/off-canvas.js     | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/core/modules/outside_in/js/off-canvas.es6.js b/core/modules/outside_in/js/off-canvas.es6.js
index 01262bef0234..aceed74be61b 100644
--- a/core/modules/outside_in/js/off-canvas.es6.js
+++ b/core/modules/outside_in/js/off-canvas.es6.js
@@ -31,6 +31,7 @@
     const offsets = displace.offsets;
     const $element = event.data.$element;
     const $widget = $element.dialog('widget');
+    const $elementScroll = $element.scrollTop();
 
     const adjustedOptions = {
       // @see http://api.jqueryui.com/position/
@@ -49,6 +50,9 @@
     $element
       .dialog('option', adjustedOptions)
       .trigger('dialogContentResize.off-canvas');
+
+    // Reset the elements scroll position after being repositioned.
+    $element.scrollTop($elementScroll);
   }
 
   /**
diff --git a/core/modules/outside_in/js/off-canvas.js b/core/modules/outside_in/js/off-canvas.js
index 16c89ab1bb61..85a9e5367580 100644
--- a/core/modules/outside_in/js/off-canvas.js
+++ b/core/modules/outside_in/js/off-canvas.js
@@ -16,6 +16,7 @@
     var offsets = displace.offsets;
     var $element = event.data.$element;
     var $widget = $element.dialog('widget');
+    var $elementScroll = $element.scrollTop();
 
     var adjustedOptions = {
       position: {
@@ -31,6 +32,8 @@
     });
 
     $element.dialog('option', adjustedOptions).trigger('dialogContentResize.off-canvas');
+
+    $element.scrollTop($elementScroll);
   }
 
   function handleDialogResize(event) {
-- 
GitLab