enhancement: don't block scrolling if HighlightCode is not scrollable (#4463)

This commit is contained in:
kyle
2018-04-20 16:34:22 -07:00
committed by GitHub
parent 62ed4db110
commit 0c50c7e99f

View File

@@ -36,10 +36,11 @@ export default class HighlightCode extends Component {
const scrollOffset = visibleHeight + scrollTop const scrollOffset = visibleHeight + scrollTop
const isElementScrollable = contentHeight > visibleHeight
const isScrollingPastTop = scrollTop === 0 && deltaY < 0 const isScrollingPastTop = scrollTop === 0 && deltaY < 0
const isScrollingPastBottom = scrollOffset >= contentHeight && deltaY > 0 const isScrollingPastBottom = scrollOffset >= contentHeight && deltaY > 0
if (isScrollingPastTop || isScrollingPastBottom) { if (isElementScrollable && (isScrollingPastTop || isScrollingPastBottom)) {
e.preventDefault() e.preventDefault()
} }
} }