Skip to content

[BUG] Morphing Dialog Basic Example causes hydration errors #167

@illia1f

Description

@illia1f

Short Description

The MorphingDialogTrigger component causes nested button hydration errors when wrapping custom buttons.

Problem Details

The MorphingDialogTrigger component currently renders as a motion.button wrapper, which causes invalid HTML structure and hydration errors when developers need to wrap custom button elements. This is particularly problematic in the example morphing-dialog-basic-1.tsx where a button is nested inside the trigger.

Current problematic structure:
<MorphingDialogTrigger className="..."> <button type="button"> {/* ... */} <PlusIcon /> </button> </MorphingDialogTrigger>

This results in:

  • Invalid HTML - Buttons cannot be nested according to HTML spec
  • React hydration errors
  • Accessibility issues
  • Event handling problems - Click events may conflict

Proposed Solutions

  1. Implement asChild Pattern (Recommended)
  2. Refactor Example to Remove Nested Button

Would you like me to prepare a pull request for this fix with asChild pattern?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions