diff --git a/wp-admin/js/editor-expand.js b/wp-admin/js/editor-expand.js
index bf67c64..f1b3caa 100644
--- a/wp-admin/js/editor-expand.js
+++ b/wp-admin/js/editor-expand.js
@@ -467,7 +467,7 @@
 			// Sidebar pinning
 			if ( $postboxContainer.width() < 300 && heights.windowWidth > 600 && // sidebar position is changed with @media from CSS, make sure it is on the side
 				$document.height() > ( $sideSortables.height() + postBodyTop + 120 ) && // the sidebar is not the tallest element
-				heights.windowHeight < editorHeight ) { // the editor is taller than the viewport
+				heights.windowHeight < $('#poststuff').outerHeight() ) { // the page content is taller than the viewport
 
 				if ( ( heights.sideSortablesHeight + pinnedToolsTop + sidebarBottom ) > heights.windowHeight || fixedSideTop || fixedSideBottom ) {
 					// Reset when scrolling to the top
