diff --git a/packages/modal/src/modalManager.ts b/packages/modal/src/modalManager.ts index e8bf02d89..3d5356933 100644 --- a/packages/modal/src/modalManager.ts +++ b/packages/modal/src/modalManager.ts @@ -231,6 +231,12 @@ export class Web3Auth extends Web3AuthNoModal implements IWeb3AuthModal { this.once(ADAPTER_EVENTS.ERRORED, (err: unknown) => { return reject(err); }); + this.once(LOGIN_MODAL_EVENTS.MODAL_VISIBILITY, (visibility: boolean) => { + // modal is closed but user is not connected to any wallet. + if (!visibility && this.status !== ADAPTER_STATUS.CONNECTED) { + return reject(new Error("User closed the modal")); + } + }); }); }