Skip to content

Commit 0614090

Browse files
author
Benjamin Pasero
committed
notifications - add container to prevent bleeding
1 parent 16900e5 commit 0614090

2 files changed

Lines changed: 20 additions & 12 deletions

File tree

src/vs/workbench/browser/parts/notifications/media/notificationsToasts.css

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121
flex-direction: column-reverse;
2222
}
2323

24-
.monaco-workbench > .notifications-toasts .notification-toast {
24+
.monaco-workbench > .notifications-toasts .notification-toast-container {
25+
overflow: hidden; /* this ensures that the notification toast does not shine through */
26+
}
27+
28+
.monaco-workbench > .notifications-toasts .notification-toast-container > .notification-toast {
2529
margin: 5px; /* enables separation and drop shadows around toasts */
2630

2731
transform: translateY(100%); /* move the notification 50px to the bottom (to prevent bleed through) */
@@ -30,14 +34,13 @@
3034
will-change: transform, opacity; /* force a separate layer for the toast to speed things up */
3135
}
3236

33-
.monaco-workbench > .notifications-toasts .notification-toast.notification-fade-in {
34-
z-index: -1; /* draw the notification below the current one */
37+
.monaco-workbench > .notifications-toasts .notification-toast-container > .notification-toast.notification-fade-in {
3538
opacity: 1;
3639
transform: none;
3740
}
3841

39-
.monaco-workbench > .notifications-toasts .notification-toast.notification-fade-in-done {
42+
.monaco-workbench > .notifications-toasts .notification-toast-container > .notification-toast.notification-fade-in-done {
43+
opacity: 1;
4044
transform: none;
4145
transition: none;
42-
opacity: 1;
4346
}

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,12 +104,17 @@ export class NotificationsToasts extends Themable {
104104

105105
// Container
106106
const notificationToastContainer = document.createElement('div');
107-
addClass(notificationToastContainer, 'notification-toast');
107+
addClass(notificationToastContainer, 'notification-toast-container');
108108
this.notificationsToastsContainer.appendChild(notificationToastContainer);
109109
itemDisposeables.push(toDisposable(() => this.notificationsToastsContainer.removeChild(notificationToastContainer)));
110110

111+
// Toast
112+
const notificationToast = document.createElement('div');
113+
addClass(notificationToast, 'notification-toast');
114+
notificationToastContainer.appendChild(notificationToast);
115+
111116
// Create toast with item and show
112-
const notificationList = this.instantiationService.createInstance(NotificationsList, notificationToastContainer, {
117+
const notificationList = this.instantiationService.createInstance(NotificationsList, notificationToast, {
113118
ariaLabel: localize('notificationsToast', "Notification Toast"),
114119
verticalScrollMode: ScrollbarVisibility.Hidden
115120
});
@@ -173,13 +178,13 @@ export class NotificationsToasts extends Themable {
173178

174179
// Animate In if we are in a running session (otherwise just show directly)
175180
if (this.lifecycleService.phase >= LifecyclePhase.Running) {
176-
addClass(notificationToastContainer, 'notification-fade-in');
177-
itemDisposeables.push(addDisposableListener(notificationToastContainer, 'transitionend', () => {
178-
removeClass(notificationToastContainer, 'notification-fade-in');
179-
addClass(notificationToastContainer, 'notification-fade-in-done');
181+
addClass(notificationToast, 'notification-fade-in');
182+
itemDisposeables.push(addDisposableListener(notificationToast, 'transitionend', () => {
183+
removeClass(notificationToast, 'notification-fade-in');
184+
addClass(notificationToast, 'notification-fade-in-done');
180185
}));
181186
} else {
182-
addClass(notificationToastContainer, 'notification-fade-in-done');
187+
addClass(notificationToast, 'notification-fade-in-done');
183188
}
184189
}
185190

0 commit comments

Comments
 (0)