notifications - compute height properly when progress is enabled (#186612)

This commit is contained in:
Benjamin Pasero
2023-06-29 12:16:46 +02:00
committed by GitHub
parent 9fe9cea876
commit c6567bcf69
3 changed files with 11 additions and 7 deletions
@@ -21,7 +21,7 @@ import { AriaRole } from 'vs/base/browser/ui/aria/aria';
import { NotificationActionRunner } from 'vs/workbench/browser/parts/notifications/notificationsCommands';
export interface INotificationsListOptions extends IListOptions<INotificationViewItem> {
widgetAriaLabel?: string;
readonly widgetAriaLabel?: string;
}
export class NotificationsList extends Disposable {
@@ -27,10 +27,10 @@ import { assertIsDefined } from 'vs/base/common/types';
import { NotificationsToastsVisibleContext } from 'vs/workbench/common/contextkeys';
interface INotificationToast {
item: INotificationViewItem;
list: NotificationsList;
container: HTMLElement;
toast: HTMLElement;
readonly item: INotificationViewItem;
readonly list: NotificationsList;
readonly container: HTMLElement;
readonly toast: HTMLElement;
}
enum ToastVisibility {
@@ -83,7 +83,10 @@ export class NotificationsListDelegate implements IListVirtualDelegate<INotifica
private computePreferredHeight(notification: INotificationViewItem): number {
// Prepare offset helper depending on toolbar actions count
let actions = 1; // close
let actions = 0;
if (!notification.hasProgress) {
actions++; // close
}
if (notification.canCollapse) {
actions++; // expand/collapse
}
@@ -132,8 +135,9 @@ export interface INotificationTemplateData {
}
interface IMessageActionHandler {
readonly toDispose: DisposableStore;
callback: (href: string) => void;
toDispose: DisposableStore;
}
class NotificationMessageRenderer {