Fix #20256 - Restore active preferences tab after page refresh#20303
Open
predictor2718 wants to merge 1 commit into
Open
Fix #20256 - Restore active preferences tab after page refresh#20303predictor2718 wants to merge 1 commit into
predictor2718 wants to merge 1 commit into
Conversation
…esh via location.hash Signed-off-by: Nicolai Ehrhardt <245527909+predictor2718@users.noreply.github.com>
a9c574f to
2afbd34
Compare
williamdes
approved these changes
May 27, 2026
williamdes
left a comment
Member
There was a problem hiding this comment.
This looks okay, I'd argue to send it to 6.0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #20256
What this fixes
On all preferences pages (
/preferences/features,/preferences/sql,/preferences/navigation,/preferences/main-panel, etc.) the active sub-tab was not remembered after a page refresh or after clicking Apply — the page always reset to the first tab.Root cause
This is a regression that affects both 5.2 and 6.0.
Commit 53f5247 ("Merge FormDisplay::getDisplay templates") replaced the old custom
ul.tabsjQuery tab system with Bootstrapdata-bs-toggle="tab". The old implementation injs/config.jshad:setTab()— setlocation.hash = 'tab_' + tabIdand wrote the value intoinput[name=tab_hash]setupConfigTabs()— wired up tab click handlerswindow.onhashchange— readlocation.hashon page load and activated the matching tabWhen Bootstrap tabs were introduced, all three were deleted without a replacement, even though the PHP side was never broken:
MainPanelController(and all other preferences controllers) still readtab_hashfrom the POST body and redirect to the same URL with the tab ID as a URL fragment viaUserPreferences::getUrlToRedirect().Fix
Restore the behaviour using Bootstrap's own API in
js/src/config.js:window.location.hashand activate the matching tab viabootstrap.Tab.getOrCreateInstance().shown.bs.tab— write the tab id back towindow.location.hashand toinput[name=tab_hash], so the PHP redirect after Apply also lands on the correct tab.shown.bs.tablistener to avoid leaks across AJAX navigation.Test
Added a Selenium E2E test
testActiveTabRestoredAfterRefreshinServerSettingsTestthat: