From 0c50c7e99f7e89a804f7e7479d6c4d26d37bdbfa Mon Sep 17 00:00:00 2001 From: kyle Date: Fri, 20 Apr 2018 16:34:22 -0700 Subject: [PATCH] enhancement: don't block scrolling if HighlightCode is not scrollable (#4463) --- src/core/components/highlight-code.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/components/highlight-code.jsx b/src/core/components/highlight-code.jsx index 22ed061e..bbdda2d0 100644 --- a/src/core/components/highlight-code.jsx +++ b/src/core/components/highlight-code.jsx @@ -36,10 +36,11 @@ export default class HighlightCode extends Component { const scrollOffset = visibleHeight + scrollTop + const isElementScrollable = contentHeight > visibleHeight const isScrollingPastTop = scrollTop === 0 && deltaY < 0 const isScrollingPastBottom = scrollOffset >= contentHeight && deltaY > 0 - if (isScrollingPastTop || isScrollingPastBottom) { + if (isElementScrollable && (isScrollingPastTop || isScrollingPastBottom)) { e.preventDefault() } }