From 3b5d3c6ff6a288cbf0d659cdb84183baa3bd8d6e Mon Sep 17 00:00:00 2001 From: Tyler Brown Cifu Shuster Date: Mon, 26 Oct 2020 16:59:14 -0700 Subject: [PATCH] chat: fixed embedded scroll item disability Fixes #3801 --- .../src/views/components/VirtualScroller.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/interface/src/views/components/VirtualScroller.tsx b/pkg/interface/src/views/components/VirtualScroller.tsx index 6410fa6140..ead595f594 100644 --- a/pkg/interface/src/views/components/VirtualScroller.tsx +++ b/pkg/interface/src/views/components/VirtualScroller.tsx @@ -244,7 +244,17 @@ export default class VirtualScroller extends PureComponent { event.preventDefault(); const normalized = normalizeWheel(event); - element.scrollBy(0, normalized.pixelY * -1); + if ( + (event.target.scrollHeight > event.target.clientHeight && event.target.clientHeight > 0) // If we're scrolling something with a scrollbar + && ( + (event.target.scrollTop > 0 && event.deltaY < 0) // Either we're not at the top and scrolling up + || (event.target.scrollTop < event.target.scrollHeight - event.target.clientHeight && event.deltaY > 0) // Or we're not at the bottom and scrolling down + ) + ) { + event.target.scrollBy(0, normalized.pixelY); + } else { + element.scrollBy(0, normalized.pixelY * -1); + } return false; }, { passive: false }); window.addEventListener('keydown', this.invertedKeyHandler, { passive: false });