diff --git a/src/vs/base/browser/ui/tree/abstractTree.ts b/src/vs/base/browser/ui/tree/abstractTree.ts index e3afcdf75f6..2a956d84150 100644 --- a/src/vs/base/browser/ui/tree/abstractTree.ts +++ b/src/vs/base/browser/ui/tree/abstractTree.ts @@ -1793,8 +1793,6 @@ class StickyScrollFocus extends Disposable { this.elements = elements; this.state = state; - this.container.tabIndex = state ? 0 : -1; - if (state) { const newFocusedIndex = clamp(previousIndex, 0, state.count - 1); this.setFocus(newFocusedIndex); @@ -1803,6 +1801,9 @@ class StickyScrollFocus extends Disposable { this.view.domFocus(); } } + + // must come last as it calls blur() + this.container.tabIndex = state ? 0 : -1; } private setFocusedElement(stickyIndex: number): void {