diff --git a/news/2 Fixes/10137.md b/news/2 Fixes/10137.md new file mode 100644 index 000000000000..47419ce382a2 --- /dev/null +++ b/news/2 Fixes/10137.md @@ -0,0 +1 @@ +Fix scrolling for output to consistently scroll even during execution. \ No newline at end of file diff --git a/src/datascience-ui/history-react/interactivePanel.tsx b/src/datascience-ui/history-react/interactivePanel.tsx index 44d7e05c31a1..bed6ec5b331e 100644 --- a/src/datascience-ui/history-react/interactivePanel.tsx +++ b/src/datascience-ui/history-react/interactivePanel.tsx @@ -354,11 +354,8 @@ ${buildSettingsCss(this.props.settings)}`} this.internalScrollCount += 1; // Force auto here as smooth scrolling can be canceled by updates to the window // from elsewhere (and keeping track of these would make this hard to maintain) - // tslint:disable: no-any - if ((div as any).scrollIntoViewIfNeeded) { - (div as any).scrollIntoViewIfNeeded(false); - } else if (div && div.scrollIntoView) { - div.scrollIntoView(false); + if (div && div.scrollIntoView) { + div.scrollIntoView({ behavior: 'auto', block: 'nearest', inline: 'nearest' }); } } }; diff --git a/src/datascience-ui/history-react/redux/reducers/effects.ts b/src/datascience-ui/history-react/redux/reducers/effects.ts index a1e667911f8b..3705f1a348bc 100644 --- a/src/datascience-ui/history-react/redux/reducers/effects.ts +++ b/src/datascience-ui/history-react/redux/reducers/effects.ts @@ -113,8 +113,7 @@ export namespace Effects { newVMs[index] = { ...newVMs[index], scrollCount: newVMs[index].scrollCount + 1 }; return { ...arg.prevState, - cellVMs: newVMs, - isAtBottom: false + cellVMs: newVMs }; } diff --git a/src/datascience-ui/interactive-common/contentPanel.tsx b/src/datascience-ui/interactive-common/contentPanel.tsx index 1692bd9a13a3..21597d333f9f 100644 --- a/src/datascience-ui/interactive-common/contentPanel.tsx +++ b/src/datascience-ui/interactive-common/contentPanel.tsx @@ -32,12 +32,10 @@ export class ContentPanel extends React.Component { constructor(prop: IContentPanelProps) { super(prop); } - public componentDidMount() { this.scrollToBottom(); } - - public componentDidUpdate() { + public componentWillReceiveProps() { this.scrollToBottom(); } @@ -58,7 +56,7 @@ export class ContentPanel extends React.Component { {this.renderCells()} -
+
); }