Skip to content

feat(react): add Dialog component#54

Draft
Poafs1 wants to merge 1 commit intomainfrom
feat/dialog-component
Draft

feat(react): add Dialog component#54
Poafs1 wants to merge 1 commit intomainfrom
feat/dialog-component

Conversation

@Poafs1
Copy link
Contributor

@Poafs1 Poafs1 commented Feb 25, 2026

Summary

  • Adds a headless, accessible Dialog (modal) component with FloatingOverlay backdrop, FloatingFocusManager focus trapping, and scroll lock
  • Supports both role="dialog" (default) and role="alertdialog" for confirmations
  • Free-form children API — consumer controls all content structure
  • Optional trigger prop for uncontrolled usage, or fully controlled via open/onOpenChange

Features

  • Always-modal focus trapping via FloatingFocusManager
  • FloatingOverlay with lockScroll for body scroll prevention
  • Configurable closeOnEscape and closeOnOverlayClick
  • initialFocus and returnFocus props for focus management
  • Portal rendering (default) with portalRoot option
  • CSS exit animations via data-state attribute and useExitTransition
  • forceMount for animation library compatibility
  • className, overlayClassName, variantName, ref forwarding

Data Attributes

Attribute Values
data-ck "dialog" / "dialog-overlay"
data-state "open" | "closed"
data-variant user-defined

Test Plan

  • 34 tests covering rendering, trigger interaction, controlled mode, dismiss behaviors, content, accessibility (dialog + alertdialog roles, aria-modal, aria-haspopup, aria-expanded), forceMount, ref forwarding, className/overlayClassName, and portal
  • All 1412 tests pass (no regressions)
  • Build passes
  • Lint passes
  • Pre-existing typecheck errors only (none in dialog files)

🤖 Generated with Claude Code

Headless, accessible Dialog (modal) with FloatingOverlay backdrop,
FloatingFocusManager focus trapping, scroll lock, optional trigger,
and role="dialog" / role="alertdialog" support.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Feb 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
packages-app Ready Ready Preview, Comment Feb 25, 2026 0:08am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant