From 7a8681481ee64a33aef62ae4079afdbbbab0ae4c Mon Sep 17 00:00:00 2001 From: Barbara Valdez <34872381+barbaravaldez@users.noreply.github.com> Date: Thu, 14 Apr 2022 10:49:17 -0700 Subject: [PATCH] fix cell nav (#19082) --- .../workbench/contrib/notebook/browser/notebook.component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sql/workbench/contrib/notebook/browser/notebook.component.ts b/src/sql/workbench/contrib/notebook/browser/notebook.component.ts index b660225e9e..a1ad27dc09 100644 --- a/src/sql/workbench/contrib/notebook/browser/notebook.component.ts +++ b/src/sql/workbench/contrib/notebook/browser/notebook.component.ts @@ -145,12 +145,11 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe // on the current active editor. const activeCellElement = this.container.nativeElement.querySelector(`.editor-group-container.active .notebook-cell.active`); let handled = false; - if (DOM.isAncestor(this.container.nativeElement, document.activeElement) && this.isActive() && this.model.activeCell) { + if ((DOM.isAncestor(this.container.nativeElement, document.activeElement) || document.activeElement === activeCellElement) && this.isActive() && this.model.activeCell) { const event = new StandardKeyboardEvent(e); if (!this.model.activeCell?.isEditMode) { if (event.keyCode === KeyCode.DownArrow) { let next = (this.findCellIndex(this.model.activeCell) + 1) % this.cells.length; - this.navigateToCell(this.cells[next]); handled = true; } else if (event.keyCode === KeyCode.UpArrow) { @@ -302,6 +301,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe private scrollToActiveCell(): void { const activeCellElement = document.querySelector(`.editor-group-container.active .notebook-cell.active`); + (activeCellElement as HTMLElement).focus(); activeCellElement.scrollIntoView({ behavior: 'auto', block: 'nearest' }); }