Close the release announcement when a dialog is opened (#12559)

* Fire `ModalManagerEvent.Closed` when a dialog is closed

* Listen to modal events in the RA

* Fix first RA test
This commit is contained in:
Florian Duros 2024-05-29 09:22:50 +02:00 committed by GitHub
parent 17ab522942
commit 679b170bc5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 63 additions and 5 deletions

View file

@ -65,10 +65,12 @@ interface IOptions<C extends ComponentType> {
export enum ModalManagerEvent {
Opened = "opened",
Closed = "closed",
}
type HandlerMap = {
[ModalManagerEvent.Opened]: () => void;
[ModalManagerEvent.Closed]: () => void;
};
export class ModalManager extends TypedEventEmitter<ModalManagerEvent, HandlerMap> {
@ -232,6 +234,7 @@ export class ModalManager extends TypedEventEmitter<ModalManagerEvent, HandlerMa
}
this.reRender();
this.emitClosed();
},
deferred.promise,
];
@ -328,6 +331,14 @@ export class ModalManager extends TypedEventEmitter<ModalManagerEvent, HandlerMa
}
}
/**
* Emit the closed event
* @private
*/
private emitClosed(): void {
this.emit(ModalManagerEvent.Closed);
}
private onBackgroundClick = (): void => {
const modal = this.getCurrentModal();
if (!modal) {