Skip to content

Commit f3a548d

Browse files
authored
Empty notification center requires show notifications to be called twice before it is focused (fix microsoft#188763) (microsoft#188973)
1 parent e3f25bf commit f3a548d

File tree

2 files changed

+10
-19
lines changed

2 files changed

+10
-19
lines changed

src/vs/workbench/browser/parts/notifications/notificationsCenter.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,10 @@ export class NotificationsCenter extends Themable implements INotificationsCente
7979
if (this._isVisible) {
8080
const notificationsList = assertIsDefined(this.notificationsList);
8181

82-
// Make visible and focus first
83-
notificationsList.show(true /* focus */);
82+
// Make visible
83+
notificationsList.show();
84+
85+
// Focus first
8486
notificationsList.focusFirst();
8587

8688
return; // already visible

src/vs/workbench/browser/parts/notifications/notificationsList.ts

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { INotificationViewItem } from 'vs/workbench/common/notifications';
1414
import { NotificationsListDelegate, NotificationRenderer } from 'vs/workbench/browser/parts/notifications/notificationsViewer';
1515
import { CopyNotificationMessageAction } from 'vs/workbench/browser/parts/notifications/notificationsActions';
1616
import { IContextMenuService } from 'vs/platform/contextview/browser/contextView';
17-
import { assertIsDefined, assertAllDefined } from 'vs/base/common/types';
17+
import { assertAllDefined } from 'vs/base/common/types';
1818
import { NotificationFocusedContext } from 'vs/workbench/common/contextkeys';
1919
import { Disposable } from 'vs/base/common/lifecycle';
2020
import { AriaRole } from 'vs/base/browser/ui/aria/aria';
@@ -43,13 +43,8 @@ export class NotificationsList extends Disposable {
4343
super();
4444
}
4545

46-
show(focus?: boolean): void {
46+
show(): void {
4747
if (this.isVisible) {
48-
if (focus) {
49-
const list = assertIsDefined(this.list);
50-
list.domFocus();
51-
}
52-
5348
return; // already visible
5449
}
5550

@@ -60,12 +55,6 @@ export class NotificationsList extends Disposable {
6055

6156
// Make visible
6257
this.isVisible = true;
63-
64-
// Focus
65-
if (focus) {
66-
const list = assertIsDefined(this.list);
67-
list.domFocus();
68-
}
6958
}
7059

7160
private createNotificationsList(): void {
@@ -221,17 +210,17 @@ export class NotificationsList extends Disposable {
221210
}
222211

223212
focusFirst(): void {
224-
if (!this.isVisible || !this.list) {
225-
return; // hidden
213+
if (!this.list) {
214+
return; // not created yet
226215
}
227216

228217
this.list.focusFirst();
229218
this.list.domFocus();
230219
}
231220

232221
hasFocus(): boolean {
233-
if (!this.isVisible || !this.listContainer) {
234-
return false; // hidden
222+
if (!this.listContainer) {
223+
return false; // not created yet
235224
}
236225

237226
return isAncestor(document.activeElement, this.listContainer);

0 commit comments

Comments
 (0)