mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -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 {
|
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.focus();
|
||||||
this._editor.getContainer().scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
this._editor.getContainer().scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,9 @@ export class OutputAreaComponent extends AngularDisposable implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private setFocusAndScroll(node: HTMLElement): void {
|
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.focus();
|
||||||
node.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
node.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user