mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
check for ownerDocument focus for focus (#7964)
This commit is contained in:
@@ -325,8 +325,10 @@ export class CodeComponent extends AngularDisposable implements OnInit, OnChange
|
|||||||
|
|
||||||
private setFocusAndScroll(): void {
|
private setFocusAndScroll(): void {
|
||||||
// If offsetParent is null, the element isn't visible
|
// 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
|
// 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) {
|
// In addition, ensure that the ownerDocument itself has focus for scenarios where ADS isn't in the foreground
|
||||||
|
let ownerDocument = this._editor.getContainer().ownerDocument;
|
||||||
|
if (this.cellModel.id === this._activeCellId && this._editor.getContainer().offsetParent && ownerDocument && ownerDocument.hasFocus()) {
|
||||||
this._editor.focus();
|
this._editor.focus();
|
||||||
this._editor.getContainer().scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
this._editor.getContainer().scrollIntoView({ behavior: 'smooth', block: 'nearest' });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user