diff --git a/indra/llui/llmultifloater.cpp b/indra/llui/llmultifloater.cpp
index 33d47a3f0e3a955170d42d59b685c2fb34d4b452..4af9108329ae6dbb131150a8764fc7d8d04942ea 100644
--- a/indra/llui/llmultifloater.cpp
+++ b/indra/llui/llmultifloater.cpp
@@ -352,6 +352,13 @@ BOOL LLMultiFloater::handleKeyHere(KEY key, MASK mask)
 		if (floater && floater->canClose() && floater->isCloseable())
 		{
 			floater->closeFloater();
+
+			// EXT-5695 (Tabbed IM window loses focus if close any tabs by Ctrl+W)
+			// bring back focus on tab container if there are any tab left
+			if(mTabContainer->getTabCount() > 0)
+			{
+				mTabContainer->setFocus(TRUE);
+			}
 		}
 		return TRUE;
 	}