Skip to content

Commit c3a8226

Browse files
committed
Make CommentsPanel widget navigatable
1 parent aea7c5b commit c3a8226

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/vs/workbench/contrib/comments/browser/commentsView.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ import { ITreeElement } from 'vs/base/browser/ui/tree/tree';
4242
import { Iterable } from 'vs/base/common/iterator';
4343
import { CommentController } from 'vs/workbench/contrib/comments/browser/commentsController';
4444
import { Range } from 'vs/editor/common/core/range';
45+
import { registerNavigatableContainer } from 'vs/workbench/browser/actions/widgetNavigationCommands';
4546

4647
const CONTEXT_KEY_HAS_COMMENTS = new RawContextKey<boolean>('commentsView.hasComments', false);
4748
const CONTEXT_KEY_SOME_COMMENTS_EXPANDED = new RawContextKey<boolean>('commentsView.someCommentsExpanded', false);
@@ -145,6 +146,23 @@ export class CommentsPanel extends FilterViewPane implements ICommentsView {
145146
super.saveState();
146147
}
147148

149+
override render(): void {
150+
super.render();
151+
this._register(registerNavigatableContainer({
152+
focusNotifiers: [this, this.filterWidget],
153+
focusNextWidget: () => {
154+
if (this.filterWidget.hasFocus()) {
155+
this.focus();
156+
}
157+
},
158+
focusPreviousWidget: () => {
159+
if (!this.filterWidget.hasFocus()) {
160+
this.focusFilter();
161+
}
162+
}
163+
}));
164+
}
165+
148166
public focusFilter(): void {
149167
this.filterWidget.focus();
150168
}

0 commit comments

Comments
 (0)