Skip to content

Auth Modal fails to close after successful connection with standard Wagmi wallets #2327

@umershaikh123

Description

@umershaikh123

[REQUIRED] Environment

  • Browser version: Chrome Version 143.0.7499.194
  • AA SDK version: ^4.67.0
  • Package: "@account-kit/react" ,

[REQUIRED] Describe the problem

The useAuthModal hook does not automatically close the modal after a successful connection with a standard Wagmi wallet (e.g., MetaMask).

When a user triggers openAuthModal and selects a non-smart wallet (like MetaMask) via the "External Wallets" option, the wallet connects successfully, but the modal remains open. If the user then manually clicks the close button on the modal, it triggers a disconnect event, effectively preventing the user from staying logged in.

This issue does not affect the Smart Wallet login flows (e.g., Google or Email login), which close the modal correctly upon success.

How to reproduce:

  1. Implement useAuthModal in a React component.

  2. Call openAuthModal() to trigger the login UI.

  3. Select an external wallet (e.g., MetaMask) from the options.

  4. Complete the connection in the wallet extension.

  5. Observe: The wallet connects (address is available), but the Auth Modal remains visible on screen.

  6. Observe: Clicking the "X" or close button on the modal disconnects the wallet immediately.

Relevant code or sample repro:

import { useAuthModal, useUser } from "@account-kit/react";


export const LoginButton = () => {
  const { openAuthModal } = useAuthModal();
  const user = useUser();

  // Issue: Modal stays open after user connects MetaMask here
  return (
    <div>
      <button onClick={openAuthModal}>Login</button>
      {user && <p>Connected: {user.address}</p>}
    </div>
  );
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions