From 0a022904f9d90c77723a8a28594343ac7f402b4b Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Fri, 15 May 2020 12:01:49 -0500 Subject: [PATCH] Fix up document focus when moving cell focus --- .../notebook/browser/view/notebookCellList.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts b/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts index 6849223732a..4ae425ece2c 100644 --- a/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts +++ b/src/vs/workbench/contrib/notebook/browser/view/notebookCellList.ts @@ -66,9 +66,15 @@ export class NotebookCellList extends WorkbenchList implements ID }); this._previousFocusedElements = e.elements; - // Force focus out of webview if focus is in webview and I press an arrow key to focus the next cell - if (document.activeElement && document.activeElement.tagName.toLowerCase() === 'webview') { - this.focusView(); + // if focus is in the list, but is not inside the focused element, then reset focus + if (DOM.isAncestor(document.activeElement, this.rowsContainer)) { + const focusedElement = this.getFocusedElements()[0]; + if (focusedElement) { + const focusedDomElement = this.domElementOfElement(focusedElement); + if (focusedDomElement && !DOM.isAncestor(document.activeElement, focusedDomElement)) { + focusedDomElement.focus(); + } + } } })); -- GitLab