Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backport 24.04: feat(mobileWizard): keep past scroll position #9371

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion browser/src/control/Control.MobileWizardWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ L.Control.MobileWizardWindow = L.Control.extend({
var parentNode = document.getElementById('mobile-wizard-content');
this.content = L.DomUtil.create('div', 'mobile-wizard mobile-wizard-content', parentNode);
this.content.id = this.id;

this.scrollPositions = [];
},

onAdd: function (map) {
Expand Down Expand Up @@ -253,6 +255,8 @@ L.Control.MobileWizardWindow = L.Control.extend({
else
$(contentToShow).children('.ui-content').first().show();

const currentScroll = this.mobileWizard.scrollTop();
this.scrollPositions.push(currentScroll);
this.mobileWizard.scrollTop(0);

this._currentDepth++;
Expand Down Expand Up @@ -325,7 +329,8 @@ L.Control.MobileWizardWindow = L.Control.extend({
$('#mobile-wizard.funcwizard div#mobile-wizard-content').addClass('hideHelpBG');
headers.show('slide', { direction: 'left' }, 'fast');

this.mobileWizard.scrollTop(0);
const prevScroll = this.scrollPositions.pop();
this.mobileWizard.scrollTop(prevScroll);

if (this._currentDepth == 0 || (this._isTabMode && this._currentDepth == 1)) {
this._inMainMenu = true;
Expand Down