Index: /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js	(revision 2761)
+++ /CKEditor/branches/prototype/_source/plugins/dialog/plugin.js	(revision 2762)
@@ -1870,4 +1870,5 @@
 	 * Sets the value of this dialog UI object.
 	 * @param {Object} value The new value.
+	 * @returns {CKEDITOR.dialog.uiElement} The current UI element.
 	 * @example
 	 * uiElement.setValue( 'Dingo' );
@@ -1877,4 +1878,5 @@
 		this.getInputElement().$.value = value;
 		this.fire( 'change', { value : value } );
+		return this;
 	},
 
@@ -1904,9 +1906,14 @@
 
 	/**
-	 * Puts the focus to the UI object. Switches tabs if the UI object isn't in the active tab page.
-	 * @example
-	 * uiElement.focus();
-	 */
-	focus : function()
+	 * Selects the parent tab of this element. Usually called by focus() or overridden focus() methods.
+	 * @returns {CKEDITOR.dialog.uiElement} The current UI element.
+	 * @example
+	 * focus : function()
+	 * {
+	 * 		this.selectParentTab();
+	 * 		// do something else.
+	 * }
+	 */
+	selectParentTab : function()
 	{
 		var element = this.getInputElement(),
@@ -1917,5 +1924,17 @@
 
 		this._.dialog.selectPage( tabId );
-		element.focus();
+		return this;
+	},
+
+	/**
+	 * Puts the focus to the UI object. Switches tabs if the UI object isn't in the active tab page.
+	 * @returns {CKEDITOR.dialog.uiElement} The current UI element.
+	 * @example
+	 * uiElement.focus();
+	 */
+	focus : function()
+	{
+		this.selectParentTab().getInputElement().focus();
+		return this;
 	},
 
@@ -1940,4 +1959,5 @@
 	 * @param {CKEDITOR.dialog.uiElementDefinition} definition The UI element
 	 * definition.
+	 * @returns {CKEDITOR.dialog.uiElement} The current UI element.
 	 * @example
 	 */
@@ -1963,4 +1983,6 @@
 				registerDomEvent( this, this._.dialog, match[1].toLowerCase(), definition[i] );
 		}
+
+		return this;
 	},
 
Index: /CKEditor/branches/prototype/_source/plugins/dialogui/plugin.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/dialogui/plugin.js	(revision 2761)
+++ /CKEditor/branches/prototype/_source/plugins/dialogui/plugin.js	(revision 2762)
@@ -870,5 +870,6 @@
 				focus : function()
 				{
-					var me = this;
+					var me = this.selectParentTab();
+
 					// GECKO BUG: setTimeout() is needed to workaround invisible selections.
 					setTimeout( function(){ me.getInputElement().$.focus(); }, 0 );
@@ -881,5 +882,6 @@
 				select : function()
 				{
-					var me = this;
+					var me = this.selectParentTab();
+
 					// GECKO BUG: setTimeout() is needed to workaround invisible selections.
 					setTimeout( function(){ var e = me.getInputElement().$; e.focus(); e.select(); }, 0 );
