enhancement: don't block scrolling if HighlightCode is not scrollable (#4463)
This commit is contained in:
@@ -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()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user