diff --git a/core/modules/overlay/overlay-parent.js b/core/modules/overlay/overlay-parent.js
index fe44502bb1df8889f50a7c9cb851e5f1600d01a8..2e3b4f99195d11e81c38666320942179a1a47800 100644
--- a/core/modules/overlay/overlay-parent.js
+++ b/core/modules/overlay/overlay-parent.js
@@ -1,4 +1,3 @@
-
 (function ($) {
 
 /**
@@ -868,8 +867,13 @@ Drupal.overlay.getDisplacement = function (region) {
   if (lastDisplaced.length) {
     displacement = lastDisplaced.offset().top + lastDisplaced.outerHeight();
 
-    // Remove height added by IE Shadow filter.
-    if (lastDisplaced[0].filters && lastDisplaced[0].filters.length && lastDisplaced[0].filters.item('DXImageTransform.Microsoft.Shadow')) {
+    // In modern browsers (including IE9), when box-shadow is defined, use the
+    // normal height.
+    var cssBoxShadowValue = lastDisplaced.css('box-shadow');
+    var boxShadow = (typeof cssBoxShadowValue !== 'undefined' && cssBoxShadowValue !== 'none');
+    // In IE8 and below, we use the shadow filter to apply box-shadow styles to
+    // the toolbar. It adds some extra height that we need to remove.
+    if (!boxShadow && /DXImageTransform\.Microsoft\.Shadow/.test(lastDisplaced.css('filter'))) {
       displacement -= lastDisplaced[0].filters.item('DXImageTransform.Microsoft.Shadow').strength;
       displacement = Math.max(0, displacement);
     }
diff --git a/core/modules/toolbar/toolbar.js b/core/modules/toolbar/toolbar.js
index 5b61634bbdee0511f684307710bf95c12d404c55..d50f20566e4efe8280957ad4cb249de3d978a525 100644
--- a/core/modules/toolbar/toolbar.js
+++ b/core/modules/toolbar/toolbar.js
@@ -94,11 +94,16 @@ Drupal.toolbar.toggle = function() {
 };
 
 Drupal.toolbar.height = function() {
-  var height = $('#toolbar').outerHeight();
-  // In IE, Shadow filter adds some extra height, so we need to remove it from
-  // the returned height.
-  if ($('#toolbar').css('filter').match(/DXImageTransform\.Microsoft\.Shadow/)) {
-    height -= $('#toolbar').get(0).filters.item("DXImageTransform.Microsoft.Shadow").strength;
+  var $toolbar = $('#toolbar');
+  var height = $toolbar.outerHeight();
+  // In modern browsers (including IE9), when box-shadow is defined, use the
+  // normal height.
+  var cssBoxShadowValue = $toolbar.css('box-shadow');
+  var boxShadow = (typeof cssBoxShadowValue !== 'undefined' && cssBoxShadowValue !== 'none');
+  // In IE8 and below, we use the shadow filter to apply box-shadow styles to
+  // the toolbar. It adds some extra height that we need to remove.
+  if (!boxShadow && /DXImageTransform\.Microsoft\.Shadow/.test($toolbar.css('filter'))) {
+    height -= $toolbar[0].filters.item("DXImageTransform.Microsoft.Shadow").strength;
   }
   return height;
 };