This commit is contained in:
rebornix
2021-03-24 13:49:02 -07:00
parent 2616ee94f3
commit ebec68bc3d
2 changed files with 9 additions and 2 deletions
@@ -65,6 +65,7 @@ export class CellEditorStatusBar extends Disposable {
) {
super();
this.statusBarContainer = DOM.append(container, $('.cell-statusbar-container'));
this.statusBarContainer.tabIndex = -1;
const leftItemsContainer = DOM.append(this.statusBarContainer, $('.cell-status-left'));
const rightItemsContainer = DOM.append(this.statusBarContainer, $('.cell-status-right'));
this.cellRunStatusContainer = DOM.append(leftItemsContainer, $('.cell-run-status'));
@@ -204,7 +204,13 @@ export class CodeCell extends Disposable {
}));
// Focus Mode
const updateFocusMode = () => viewCell.focusMode = templateData.editor.hasWidgetFocus() ? CellFocusMode.Editor : CellFocusMode.Container;
const updateFocusMode = () => {
viewCell.focusMode =
(templateData.editor.hasWidgetFocus() || (document.activeElement && this.templateData.statusBar.statusBarContainer.contains(document.activeElement)))
? CellFocusMode.Editor
: CellFocusMode.Container;
};
this._register(templateData.editor.onDidFocusEditorWidget(() => {
updateFocusMode();
}));
@@ -212,7 +218,7 @@ export class CodeCell extends Disposable {
// this is for a special case:
// users click the status bar empty space, which we will then focus the editor
// so we don't want to update the focus state too eagerly
if (document.activeElement?.contains(this.templateData.container)) {
if (document.activeElement && this.templateData.statusBar.statusBarContainer.contains(document.activeElement)) {
setTimeout(() => {
updateFocusMode();
}, 300);