diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index 08ce31ffc5d8612218a70c51119c5d933b0e011d..b1968e6a42b92cfc2ce43a0622e3c79b521c920a 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -523,6 +523,15 @@ void LLLayoutStack::updateLayout()
 	mNeedsLayout = continue_animating;
 } // end LLLayoutStack::updateLayout
 
+void LLLayoutStack::setPanelSpacing(S32 val)
+{
+    if (mPanelSpacing != val)
+    {
+        mPanelSpacing = val;
+        mNeedsLayout = true;
+    }
+}
+
 LLLayoutPanel* LLLayoutStack::findEmbeddedPanel(LLPanel* panelp) const
 {
 	if (!panelp) return NULL;
diff --git a/indra/llui/lllayoutstack.h b/indra/llui/lllayoutstack.h
index 02685281ef708af23a8f5a5bfde268daa50809dc..000b919ae761a3c49f93fa75b6f4477ad9e67f46 100644
--- a/indra/llui/lllayoutstack.h
+++ b/indra/llui/lllayoutstack.h
@@ -91,6 +91,7 @@ class LLLayoutStack : public LLView, public LLInstanceTracker<LLLayoutStack>
 	void updateLayout();
 
 	S32 getPanelSpacing() const { return mPanelSpacing; }
+    void setPanelSpacing(S32 val);
 	
 	static void updateClass();
 
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index 5ae61f0c36ad6aca1d0523f6b2eb7c20c8f70bdc..27c8f10889c9adae9a373cbd24a4a1de025deb09 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -256,6 +256,7 @@ BOOL LLPanelMainInventory::postBuild()
     mCombinationViewPanel = getChild<LLPanel>("combination_view_inventory");
     mCombinationGalleryLayoutPanel = getChild<LLLayoutPanel>("comb_gallery_layout");
     mCombinationListLayoutPanel = getChild<LLLayoutPanel>("comb_inventory_layout");
+    mCombinationLayoutStack = getChild<LLLayoutStack>("combination_view_stack");
 
     mCombinationInventoryPanel = getChild<LLInventorySingleFolderPanel>("comb_single_folder_inv");
     LLInventoryFilter& comb_inv_filter = mCombinationInventoryPanel->getFilter();
@@ -2371,6 +2372,7 @@ void LLPanelMainInventory::updatePanelVisibility()
             comb_gallery_filter.setFilterThumbnails(LLInventoryFilter::FILTER_INCLUDE_THUMBNAILS);
             comb_gallery_filter.markDefault();
 
+            mCombinationLayoutStack->setPanelSpacing(0);
             mCombinationGalleryLayoutPanel->setVisible(mSingleFolderMode && isGalleryViewMode());
             mCombinationGalleryPanel->setVisible(mSingleFolderMode && isGalleryViewMode()); // to prevent or process updates
             mCombinationListLayoutPanel->setVisible(mSingleFolderMode && isListViewMode());
@@ -2390,6 +2392,10 @@ void LLPanelMainInventory::updateCombinationVisibility()
     {
         bool is_gallery_empty = !mCombinationGalleryPanel->hasVisibleItems();
         bool show_inv_pane = mCombinationInventoryPanel->hasVisibleItems() || is_gallery_empty || mForceShowInvLayout;
+
+        const S32 DRAG_HANDLE_PADDING = 12; // for drag handle to not overlap gallery when both inventories are visible
+        mCombinationLayoutStack->setPanelSpacing(show_inv_pane ? DRAG_HANDLE_PADDING : 0);
+
         mCombinationGalleryLayoutPanel->setVisible(!is_gallery_empty);
         mCombinationListLayoutPanel->setVisible(show_inv_pane);
         mCombinationInventoryPanel->getRootFolder()->setForceArrange(!show_inv_pane);
diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h
index bdc62fd8f720520059db3ada7f73ac31cee8f374..79501e63bc11278133f4e44b70561280c8357b2e 100644
--- a/indra/newview/llpanelmaininventory.h
+++ b/indra/newview/llpanelmaininventory.h
@@ -210,7 +210,8 @@ class LLPanelMainInventory : public LLPanel, LLInventoryObserver
     LLInventorySingleFolderPanel* mCombinationInventoryPanel;
     LLInventoryGallery* mCombinationGalleryPanel;
     LLPanel* mCombinationGalleryLayoutPanel;
-    LLPanel* mCombinationListLayoutPanel;
+    LLLayoutPanel* mCombinationListLayoutPanel;
+    LLLayoutStack* mCombinationLayoutStack;
 
     boost::signals2::connection mListViewRootUpdatedConnection;
     boost::signals2::connection mGalleryRootUpdatedConnection;
diff --git a/indra/newview/skins/default/xui/en/panel_main_inventory.xml b/indra/newview/skins/default/xui/en/panel_main_inventory.xml
index b735dcf5289c74e9aad073f80c691cbc09f4b607..f7a9c552cc47f6853b5854d1c7d7d742e40c3b5e 100644
--- a/indra/newview/skins/default/xui/en/panel_main_inventory.xml
+++ b/indra/newview/skins/default/xui/en/panel_main_inventory.xml
@@ -271,7 +271,7 @@
     <panel
      follows="all"
      halign="center"
-     height="372"
+     height="375"
      layout="topleft"
      left="7"
      name="combination_view_inventory"
@@ -280,9 +280,9 @@
      <layout_stack
       follows="all"
       layout="topleft"
-      height="372"
+      height="375"
+      name="combination_view_stack"
       animate="false"
-      drag_handle_gap="13"
       drag_handle_thickness="6"
       drag_handle_first_indent="18"
       drag_handle_second_indent="18"
@@ -296,7 +296,7 @@
         bevel_style="in"
         user_resize="true"
         auto_resize="true"
-        height="246"
+        height="248"
         min_width="150"
         name="comb_gallery_layout">
         <panel
@@ -304,7 +304,7 @@
          filename="panel_inventory_gallery.xml"
          left="0"
          top="1"
-         height="246"
+         height="248"
          name="comb_gallery_view_inv"
          background_visible="true"
          follows="all"
@@ -316,7 +316,7 @@
         bevel_style="in"
         user_resize="true"
         auto_resize="true"
-        height="126"
+        height="127"
         min_height="100"
         name="comb_inventory_layout">
         <single_folder_inventory_panel
@@ -324,7 +324,7 @@
          follows="all"
          left="0"
          top="1"
-         height="126"
+         height="127"
          layout="topleft"
          show_item_link_overlays="true"
          bg_opaque_color="DkGray2"