- // Preserve the tab after saving the preferences
- // Not using cookies, because their deletion results are inconsistent.
- // Not using jStorage due to its enormous size (for this feature)
- if ( window.sessionStorage ) {
- if ( sessionStorage.getItem( 'mediawikiPreferencesTab' ) !== null ) {
- switchPrefTab( sessionStorage.getItem( 'mediawikiPreferencesTab' ), 'noHash' );
- }
+ // Restore the active tab after saving the preferences
+ previousTab = mw.storage.session.get( 'mwpreferences-prevTab' );
+ if ( previousTab ) {
+ switchPrefTab( previousTab, 'noHash' );