Skip to content

Commit 68e0010

Browse files
authored
Fix scrolling in the interactive window (#10319)
1 parent edcae3d commit 68e0010

File tree

4 files changed

+6
-11
lines changed

4 files changed

+6
-11
lines changed

news/2 Fixes/10137.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix scrolling for output to consistently scroll even during execution.

src/datascience-ui/history-react/interactivePanel.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -355,11 +355,8 @@ ${buildSettingsCss(this.props.settings)}`}</style>
355355
this.internalScrollCount += 1;
356356
// Force auto here as smooth scrolling can be canceled by updates to the window
357357
// from elsewhere (and keeping track of these would make this hard to maintain)
358-
// tslint:disable: no-any
359-
if ((div as any).scrollIntoViewIfNeeded) {
360-
(div as any).scrollIntoViewIfNeeded(false);
361-
} else if (div && div.scrollIntoView) {
362-
div.scrollIntoView(false);
358+
if (div && div.scrollIntoView) {
359+
div.scrollIntoView({ behavior: 'auto', block: 'nearest', inline: 'nearest' });
363360
}
364361
}
365362
};

src/datascience-ui/history-react/redux/reducers/effects.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,7 @@ export namespace Effects {
113113
newVMs[index] = { ...newVMs[index], scrollCount: newVMs[index].scrollCount + 1 };
114114
return {
115115
...arg.prevState,
116-
cellVMs: newVMs,
117-
isAtBottom: false
116+
cellVMs: newVMs
118117
};
119118
}
120119

src/datascience-ui/interactive-common/contentPanel.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,10 @@ export class ContentPanel extends React.Component<IContentPanelProps> {
3434
constructor(prop: IContentPanelProps) {
3535
super(prop);
3636
}
37-
3837
public componentDidMount() {
3938
this.scrollToBottom();
4039
}
41-
42-
public componentDidUpdate() {
40+
public componentWillReceiveProps() {
4341
this.scrollToBottom();
4442
}
4543

@@ -58,7 +56,7 @@ export class ContentPanel extends React.Component<IContentPanelProps> {
5856
<div id="cell-table" role="list">
5957
{this.renderCells()}
6058
</div>
61-
<div ref={this.bottomRef} />
59+
<div id="bottomDiv" ref={this.bottomRef} />
6260
</div>
6361
);
6462
}

0 commit comments

Comments
 (0)