Fix for Sticky Scroll Focus Space Key Issue (#203314)

sticky scroll focus "Space" fix
This commit is contained in:
Benjamin Simmonds 2024-01-24 11:41:01 +01:00 committed by GitHub
parent 205e4e53a1
commit c75ad1fd11
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 5 deletions

View file

@ -1767,8 +1767,10 @@ class StickyScrollFocus<T, TFilterData, TRef> extends Disposable {
private _domHasFocus: boolean = false;
private get domHasFocus(): boolean { return this._domHasFocus; }
private set domHasFocus(hasFocus: boolean) {
this._domHasFocus = hasFocus;
this._onDidChangeHasFocus.fire(hasFocus);
if (hasFocus !== this._domHasFocus) {
this._onDidChangeHasFocus.fire(hasFocus);
this._domHasFocus = hasFocus;
}
}
constructor(

View file

@ -266,7 +266,7 @@ function revealFocusedStickyScroll(tree: ObjectTree<any, any> | DataTree<any, an
}
tree.reveal(focus[0]);
tree.domFocus();
tree.getHTMLElement().focus(); // domfocus() would focus stiky scroll dom and not the tree todo@benibenj
tree.setFocus(focus);
postRevealAction?.(focus[0]);
}
@ -718,7 +718,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
});
KeybindingsRegistry.registerCommandAndKeybindingRule({
id: 'list.toggleExpand',
id: 'list.stickyScrolltoggleExpand',
weight: KeybindingWeight.WorkbenchContrib + 50, // priorities over file explorer
when: WorkbenchTreeStickyScrollFocused,
primary: KeyCode.Space,
@ -729,7 +729,7 @@ KeybindingsRegistry.registerCommandAndKeybindingRule({
return;
}
revealFocusedStickyScroll(widget, focus => widget.setSelection([focus]));
revealFocusedStickyScroll(widget);
}
});