Skip to content

Instantly share code, notes, and snippets.

@jimevans
Created July 17, 2019 14:00
Show Gist options
  • Select an option

  • Save jimevans/1cd6ce2fcf2ff0ae9663039baa650f47 to your computer and use it in GitHub Desktop.

Select an option

Save jimevans/1cd6ce2fcf2ff0ae9663039baa650f47 to your computer and use it in GitHub Desktop.
diff --git a/javascript/atoms/dom.js b/javascript/atoms/dom.js
index d219876..0936a84 100644
--- a/javascript/atoms/dom.js
+++ b/javascript/atoms/dom.js
@@ -740,6 +740,23 @@ bot.dom.getOverflowState = function(elem, opt_region) {
return bot.dom.OverflowState.HIDDEN;
}
+ if (goog.userAgent.IE) {
+ // On IE, if the containing element has scroll bars, the
+ // height and width given by getComputedStyle differ from the
+ // client bounding rect. To avoid accidentally assuming the
+ // point is not overflowed, when it's really behind a scrollbar,
+ // use the effective height and width of the container.
+ var effectiveWidth = goog.string.parseInt(bot.dom.getEffectiveStyle(container, "width"));
+ var effectiveHeight = goog.string.parseInt(bot.dom.getEffectiveStyle(container, "height"));
+ if (effectiveWidth != containerRect.width ||
+ effectiveHeight != containerRect.height) {
+ containerRect = new goog.math.Rect(containerRect.left,
+ containerRect.top,
+ effectiveWidth,
+ effectiveHeight);
+ }
+ }
+
// Check "underflow": if an element is to the left or above the container
var underflowsX = region.right < containerRect.left;
var underflowsY = region.bottom < containerRect.top;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment