diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp
index 83fcdb566e466a66562fff46f3f83e581056fe3d..d3e16a35b023b4bb86581dfa237784f336eaa1d1 100644
--- a/indra/newview/llsidetray.cpp
+++ b/indra/newview/llsidetray.cpp
@@ -540,6 +540,32 @@ bool LLSideTray::isTabAttached(const std::string& name)
 	return std::find(mTabs.begin(), mTabs.end(), tab) != mTabs.end();
 }
 
+// [RLVa:KB] - Checked: 2010-09-07 (RLVa-1.2.1a) | Added: RLVa-1.2.1a
+void LLSideTray::toggleTabDocked(const std::string& strTabName)
+{
+	if (!isTabAttached(strTabName))
+	{
+		for (child_vector_iter_t itTab = mDetachedTabs.begin(); itTab != mDetachedTabs.end(); ++itTab)
+		{
+			LLSideTrayTab* pTab = *itTab;
+			if (strTabName == pTab->getName())
+			{
+				pTab->toggleTabDocked();
+				return;
+			}
+		}
+	}
+	else
+	{
+		LLSideTrayTab* pTab = getTab(strTabName);
+		if (pTab)
+		{
+			pTab->toggleTabDocked();
+		}
+	}
+}
+// [/RLVa:KB]
+
 bool LLSideTray::hasTabs()
 {
 	// The open/close tab doesn't count.
diff --git a/indra/newview/llsidetray.h b/indra/newview/llsidetray.h
index d7198973ef586710a2c29e92273287cbdee71bbd..7f6b543025c5f4423d1485954f203102c2fba5ce 100644
--- a/indra/newview/llsidetray.h
+++ b/indra/newview/llsidetray.h
@@ -176,6 +176,10 @@ class LLSideTray : public LLPanel, private LLDestroyClass<LLSideTray>
 
 	bool 		isTabAttached	(const std::string& name);
 
+// [RLVa:KB] - Checked: 2010-09-07 (RLVa-1.2.1a) | Added: RLVa-1.2.1a
+	void 		toggleTabDocked(const std::string& strTabName);
+// [/RLVa:KB]
+
 protected:
 	bool		hasTabs			();
 
diff --git a/indra/newview/rlvui.cpp b/indra/newview/rlvui.cpp
index 685bd87cffbe9cd2477b6633d1423583a5497896..6d55b076eca0e5c316bdf8b0b553165459a40596 100644
--- a/indra/newview/rlvui.cpp
+++ b/indra/newview/rlvui.cpp
@@ -170,18 +170,33 @@ void RlvUIEnabler::onToggleSetEnv()
 	}
 }
 
-// Checked: 2010-08-24 (RLVa-1.2.1a) | Modified: RLVa-1.2.1a
+// Checked: 2010-09-07 (RLVa-1.2.1a) | Modified: RLVa-1.2.1a
 void RlvUIEnabler::onToggleShowInv()
 {
 	bool fEnable = !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWINV);
 
 	//
-	// Enable/disable the "My Inventory" button on the sidebar button panel
+	// Enable/disable the "My Inventory" sidebar tab
 	//
 	LLSideTray* pSideTray = LLSideTray::getInstance(); 
 	RLV_ASSERT(pSideTray);
 	if (pSideTray)
 	{
+		// If the inventory sidebar tab is currently undocked we need to redock it first
+		if ( (!fEnable) && (!pSideTray->isTabAttached("sidebar_inventory")) )
+		{
+			// NOTE: redocking will expand the sidebar and select the redocked tab so we need enough information to undo that again
+			bool fCollapsed = pSideTray->getCollapsed();
+			const LLPanel* pActiveTab = pSideTray->getActiveTab();
+
+			pSideTray->toggleTabDocked("sidebar_inventory");
+
+			if (pActiveTab)
+				pSideTray->selectTabByName(pActiveTab->getName());
+			if (fCollapsed)
+				pSideTray->collapseSideBar();
+		}
+
 		LLButton* pInvBtn = pSideTray->getButtonFromName("sidebar_inventory");
 		RLV_ASSERT(pInvBtn);
 		if (pInvBtn) 
@@ -209,6 +224,7 @@ void RlvUIEnabler::onToggleShowInv()
 	// Enable/disable the "My Outfits" panel on the "My Appearance" sidebar tab
 	//
 	LLPanelOutfitsInventory* pAppearancePanel = LLPanelOutfitsInventory::findInstance();
+	RLV_ASSERT(pAppearancePanel);
 	if (pAppearancePanel)
 	{
 		LLTabContainer* pAppearanceTabs = pAppearancePanel->getAppearanceTabs();