Skip to content

Commit c75ad1f

Browse files
authored
Fix for Sticky Scroll Focus Space Key Issue (microsoft#203314)
sticky scroll focus "Space" fix
1 parent 205e4e5 commit c75ad1f

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/vs/base/browser/ui/tree/abstractTree.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,8 +1767,10 @@ class StickyScrollFocus<T, TFilterData, TRef> extends Disposable {
17671767
private _domHasFocus: boolean = false;
17681768
private get domHasFocus(): boolean { return this._domHasFocus; }
17691769
private set domHasFocus(hasFocus: boolean) {
1770-
this._domHasFocus = hasFocus;
1771-
this._onDidChangeHasFocus.fire(hasFocus);
1770+
if (hasFocus !== this._domHasFocus) {
1771+
this._onDidChangeHasFocus.fire(hasFocus);
1772+
this._domHasFocus = hasFocus;
1773+
}
17721774
}
17731775

17741776
constructor(

src/vs/workbench/browser/actions/listCommands.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ function revealFocusedStickyScroll(tree: ObjectTree<any, any> | DataTree<any, an
266266
}
267267

268268
tree.reveal(focus[0]);
269-
tree.domFocus();
269+
tree.getHTMLElement().focus(); // domfocus() would focus stiky scroll dom and not the tree todo@benibenj
270270
tree.setFocus(focus);
271271
postRevealAction?.(focus[0]);
272272
}
@@ -718,7 +718,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
718718
});
719719

720720
KeybindingsRegistry.registerCommandAndKeybindingRule({
721-
id: 'list.toggleExpand',
721+
id: 'list.stickyScrolltoggleExpand',
722722
weight: KeybindingWeight.WorkbenchContrib + 50, // priorities over file explorer
723723
when: WorkbenchTreeStickyScrollFocused,
724724
primary: KeyCode.Space,
@@ -729,7 +729,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
729729
return;
730730
}
731731

732-
revealFocusedStickyScroll(widget, focus => widget.setSelection([focus]));
732+
revealFocusedStickyScroll(widget);
733733
}
734734
});
735735

0 commit comments

Comments
 (0)