Skip to content

ConnectButton detailsModal causes hydration error: nested <button> in copy address #8590

@HayatoKanee

Description

@HayatoKanee

When using ConnectButton with detailsModal, opening the wallet details modal triggers a React hydration error:


In HTML, <button> cannot be a descendant of <button>.
This will cause a hydration error.

Environment:

thirdweb: v5 (latest)
Next.js 16 / React 19
Browser: Chrome

Reproduction:

<ConnectButton
  client={thirdwebClient}
  wallets={wallets}
  chain={defaultChain}
  detailsButton={{
    displayBalanceToken: { [defaultChain.id]: USDC_ADDRESS },
  }}
  detailsModal={{ showTestnetFaucet: false }}
/>
  1. Connect wallet
  2. Click the connected wallet button to open details modal
  3. Console shows hydration error

Root Cause:

The copy address CopyIcon component uses a <button> element, but it appears to be rendered inside another button context in the modal. Suggested Fix: Replace the nested <button> with <div role="button" tabIndex={0}> or <span> with click handler to maintain accessibility without violating HTML spec.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions