Skip to content

Fix scrolling in the interactive window #10319

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/2 Fixes/10137.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix scrolling for output to consistently scroll even during execution.
7 changes: 2 additions & 5 deletions src/datascience-ui/history-react/interactivePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -354,11 +354,8 @@ ${buildSettingsCss(this.props.settings)}`}</style>
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' });
}
}
};
Expand Down
3 changes: 1 addition & 2 deletions src/datascience-ui/history-react/redux/reducers/effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
};
}

Expand Down
6 changes: 2 additions & 4 deletions src/datascience-ui/interactive-common/contentPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,10 @@ export class ContentPanel extends React.Component<IContentPanelProps> {
constructor(prop: IContentPanelProps) {
super(prop);
}

public componentDidMount() {
this.scrollToBottom();
}

public componentDidUpdate() {
public componentWillReceiveProps() {
this.scrollToBottom();
}

Expand All @@ -58,7 +56,7 @@ export class ContentPanel extends React.Component<IContentPanelProps> {
{this.renderCells()}
</div>
</div>
<div ref={this.bottomRef} />
<div id="bottomDiv" ref={this.bottomRef} />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ID is nice, this was one of the "empty" divs I was trying to track down in my change at one point.

</div>
);
}
Expand Down