diff --git wp-admin/js/wp-fullscreen.dev.js wp-admin/js/wp-fullscreen.dev.js
index e9678c9..9e15344 100644
--- wp-admin/js/wp-fullscreen.dev.js
+++ wp-admin/js/wp-fullscreen.dev.js
@@ -4,7 +4,7 @@
  * A lightweight publish/subscribe implementation.
  * Private use only!
  */
-var PubSub, fullscreen, wptitlehint;
+var PubSub, fullscreen, wptitlehint, wpDialogOpen = false;
 
 PubSub = function() {
 	this.topics = {};
@@ -486,8 +486,6 @@ PubSub.prototype.publish = function( topic, args ) {
 				else
 					a = e.altKey; // Alt key for Win & Linux
 
-				if ( 27 == c ) // Esc
-					fullscreen.off();
 
 				if ( a && (61 == c || 187 == c) ) // +
 					api.dfw_width(25);
@@ -501,6 +499,16 @@ PubSub.prototype.publish = function( topic, args ) {
 				return true;
 			});
 
+			$(document).keydown(function(e){
+				var c = e.charCode || e.keyCode;
+
+				// The Esc key check has to be in keydown since Thickbox and tinyMCE's wpDialog
+				// all handle Esc presses on keydown.
+				if ( 27 == c && ! wpDialogOpen ) { // Esc
+					fullscreen.off();
+				}
+			});
+
 			topbar.mouseenter(function(e){
 				s.toolbars.addClass('fullscreen-make-sticky');
 				$( document ).unbind( '.fullscreen' );
diff --git wp-includes/js/thickbox/thickbox.js wp-includes/js/thickbox/thickbox.js
index d4b3710..f367d77 100644
--- wp-includes/js/thickbox/thickbox.js
+++ wp-includes/js/thickbox/thickbox.js
@@ -14,6 +14,8 @@ if ( typeof tb_closeImage != 'string' ) {
 
 /*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/
 
+var wpDialogOpen = false;
+
 //on page load call tb_init
 jQuery(document).ready(function(){
 	tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
@@ -36,6 +38,7 @@ function tb_click(){
 }
 
 function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link
+	wpDialogOpen = true;
 
 	try {
 		if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
@@ -283,6 +286,11 @@ function tb_remove() {
 	}
 	document.onkeydown = "";
 	document.onkeyup = "";
+
+	// Add a small timeout just to ensure that code that checks wpDialogOpen can
+	// run before the variable is updated.
+	setTimeout( 'wpDialogOpen = false;', 100 );
+
 	return false;
 }
 
diff --git wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog.dev.js wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog.dev.js
index 620213f..8b4d459 100644
--- wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog.dev.js
+++ wp-includes/js/tinymce/plugins/wpdialogs/js/wpdialog.dev.js
@@ -1,3 +1,5 @@
+var wpDialogOpen = false;
+
 (function($){
 	$.widget("wp.wpdialog", $.ui.dialog, {
 		open: function() {
@@ -13,11 +15,21 @@
 				return;
 			}
 
+			wpDialogOpen = true;
+
 			// Open the dialog.
 			$.ui.dialog.prototype.open.apply( this, arguments );
 			// WebKit leaves focus in the TinyMCE editor unless we shift focus.
 			this.element.focus();
 			this._trigger('refresh');
+		},
+
+		close: function() {
+			$.ui.dialog.prototype.close.apply( this, arguments );
+
+			// Add a small timeout just to ensure that code that checks wpDialogOpen can
+			// run before the variable is updated.
+			setTimeout( 'wpDialogOpen = false;', 100 );
 		}
 	});
 })(jQuery);
