Index: src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java
===================================================================
--- src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java	(revision 17083)
+++ src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java	(working copy)
@@ -229,6 +229,7 @@
     public void dispose() {
         previouslySelected = tpPreferences.getSelectedTab();
         removeWindowListener(windowEventHandler);
+        setVisible(false); // save current geometry
         super.dispose();
     }
 }
Index: src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java
===================================================================
--- src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java	(revision 17083)
+++ src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java	(working copy)
@@ -642,6 +642,10 @@
                     Icon icon = getIconAt(index);
                     remove(index);
                     if (index <= insertGUITabsForSetting(icon, preferenceSettings, index)) {
+                        if (index > 0) {
+                            // see #19876: avoid situation when icon in left pane doesn't match the preference setting
+                            setSelectedIndex(0);
+                        }
                         setSelectedIndex(index);
                     }
                 } catch (SecurityException ex) {
