diff --git a/packages/react-devtools-scheduling-profiler/src/view-base/VerticalScrollView.js b/packages/react-devtools-scheduling-profiler/src/view-base/VerticalScrollView.js index a78e88425faa2..1e273bb1fa997 100644 --- a/packages/react-devtools-scheduling-profiler/src/view-base/VerticalScrollView.js +++ b/packages/react-devtools-scheduling-profiler/src/view-base/VerticalScrollView.js @@ -255,12 +255,14 @@ export class VerticalScrollView extends View { } _setScrollState(proposedState: ScrollState): boolean { - const height = this._contentView.frame.size.height; + const contentHeight = this._contentView.frame.size.height; + const containerHeight = this.frame.size.height; + const clampedState = clampState({ state: proposedState, - minContentLength: height, - maxContentLength: height, - containerLength: this.frame.size.height, + minContentLength: contentHeight, + maxContentLength: contentHeight, + containerLength: containerHeight, }); if (!areScrollStatesEqual(clampedState, this._scrollState)) { this._scrollState.offset = clampedState.offset; @@ -275,6 +277,13 @@ export class VerticalScrollView extends View { return true; } - return false; + // Don't allow wheel events to bubble past this view even if we've scrolled to the edge. + // It just feels bad to have the scrolling jump unexpectedly from in a container to the outer page. + // The only exception is when the container fitst the contnet (no scrolling). + if (contentHeight === containerHeight) { + return false; + } + + return true; } }