Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Emit ModalManagerEvent.Opened at false if there is no more dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
florianduros committed May 28, 2024
1 parent f4fce5e commit 446734b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,13 @@ export class ModalManager extends TypedEventEmitter<ModalManagerEvent, HandlerMa
}

/**
* Emit the opened event with false
* Emit the opened event with false if there is no modal open
* @private
*/
private emitClosed(): void {

This comment has been minimized.

Copy link
@t3chguy

t3chguy May 28, 2024

Member

I think semantically it'd make more sense for this event to not be re-used. Currently Opened is not coupled to rendering/closing so it is weird to add it there but conditionally. So it'd make more sense IMO to have a Closed event which is emitted unconditionally by emitClosed and then the receiver can check hasDialogs

this.emit(ModalManagerEvent.Opened, false);
if (!this.getCurrentModal()) {
this.emit(ModalManagerEvent.Opened, false);
}
}

private onBackgroundClick = (): void => {
Expand Down

0 comments on commit 446734b

Please sign in to comment.