Skip to content
Snippets Groups Projects
Commit 845b1c6c authored by Scott Reeves's avatar Scott Reeves
Browse files

Issue #2902361 by drpal: [regression] In Settings Tray when the form is longer...

Issue #2902361 by drpal: [regression] In Settings Tray when the form is longer than the page body it is tricky to scroll to the very bottom
parent 7b7779f6
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
...@@ -155,6 +155,7 @@ ...@@ -155,6 +155,7 @@
const offsets = displace.offsets; const offsets = displace.offsets;
const $element = event.data.$element; const $element = event.data.$element;
const container = Drupal.offCanvas.getContainer($element); const container = Drupal.offCanvas.getContainer($element);
const $elementScroll = $element.scrollTop();
const topPosition = (offsets.top !== 0 ? `+${offsets.top}` : ''); const topPosition = (offsets.top !== 0 ? `+${offsets.top}` : '');
const adjustedOptions = { const adjustedOptions = {
...@@ -174,6 +175,9 @@ ...@@ -174,6 +175,9 @@
$element $element
.dialog('option', adjustedOptions) .dialog('option', adjustedOptions)
.trigger('dialogContentResize.off-canvas'); .trigger('dialogContentResize.off-canvas');
// Reset the elements scroll position after being repositioned.
$element.scrollTop($elementScroll);
}, },
/** /**
......
...@@ -73,6 +73,7 @@ ...@@ -73,6 +73,7 @@
var offsets = displace.offsets; var offsets = displace.offsets;
var $element = event.data.$element; var $element = event.data.$element;
var container = Drupal.offCanvas.getContainer($element); var container = Drupal.offCanvas.getContainer($element);
var $elementScroll = $element.scrollTop();
var topPosition = offsets.top !== 0 ? '+' + offsets.top : ''; var topPosition = offsets.top !== 0 ? '+' + offsets.top : '';
var adjustedOptions = { var adjustedOptions = {
...@@ -89,6 +90,8 @@ ...@@ -89,6 +90,8 @@
}); });
$element.dialog('option', adjustedOptions).trigger('dialogContentResize.off-canvas'); $element.dialog('option', adjustedOptions).trigger('dialogContentResize.off-canvas');
$element.scrollTop($elementScroll);
}, },
bodyPadding: function bodyPadding(event) { bodyPadding: function bodyPadding(event) {
if ($('body').outerWidth() < Drupal.offCanvas.minDisplaceWidth) { if ($('body').outerWidth() < Drupal.offCanvas.minDisplaceWidth) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment