mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-21 17:22:55 -05:00
Stop grabbing focus when nb editor isn't in view (#7466)
* Stop grabbing focus when nb editor isn't in view * Add comments
This commit is contained in:
@@ -305,7 +305,9 @@ export class CodeComponent extends AngularDisposable implements OnInit, OnChange
|
||||
}
|
||||
|
||||
private setFocusAndScroll(): void {
|
||||
if (this.cellModel.id === this._activeCellId) {
|
||||
// If offsetParent is null, the element isn't visible
|
||||
// In this case, we don't want a cell to grab focus for an editor that isn't in the foreground
|
||||
if (this.cellModel.id === this._activeCellId && this._editor.getContainer().offsetParent) {
|
||||
this._editor.focus();
|
||||
this._editor.getContainer().scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
||||
}
|
||||
|
||||
@@ -54,7 +54,9 @@ export class OutputAreaComponent extends AngularDisposable implements OnInit {
|
||||
}
|
||||
|
||||
private setFocusAndScroll(node: HTMLElement): void {
|
||||
if (node) {
|
||||
// If offsetParent is null, the element isn't visible
|
||||
// In this case, we don't want a cell to grab focus for an editor that isn't in the foreground
|
||||
if (node && node.offsetParent) {
|
||||
node.focus();
|
||||
node.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user