diff --git a/src/sql/base/browser/ui/table/table.ts b/src/sql/base/browser/ui/table/table.ts index ea24ac7f9b..1ee042ff62 100644 --- a/src/sql/base/browser/ui/table/table.ts +++ b/src/sql/base/browser/ui/table/table.ts @@ -79,8 +79,9 @@ export class Table extends Widget implements IDisposa this._container = document.createElement('div'); this._container.className = 'monaco-table'; - this._register(DOM.addDisposableListener(this._container, DOM.EventType.FOCUS, () => { - if (!this.grid.getActiveCell() && this._data.getLength() > 0) { + this._register(DOM.addDisposableListener(this._container, DOM.EventType.FOCUS, (e: FocusEvent) => { + // the focus redirection should only happen when the event target is the container (using keyboard navigation) + if (e.target && this._container === e.target && !this.grid.getActiveCell() && this._data.getLength() > 0) { // When the table receives focus and there are currently no active cell, the focus should go to the first focusable cell. let cellToFocus = undefined; for (let col = 0; col < this.columns.length; col++) {