Skip to content

UI kit: Dialog #2266

Open
Open

Description

@trillium

Trillium Firstmate 🤖

Overview

Create the shared modal dialog to replace MUI Modal and Dialog (3 places), with focus trapping, Escape to close, and a screen-reader title.

Dependencies

Action Items

  • Add @radix-ui/react-dialog.
  • Create client/src/components/ui/dialog.tsx exporting Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, DialogClose. Style the overlay and panel like today's: see the MUI Modal box in components/ChangesModal.jsx (warning icon, text, two buttons) and Dialog in components/manageProjects/editProject.jsx.
  • Support both a controlled (open + onOpenChange) and an uncontrolled use, since the current code opens modals from state.
  • Tests: opens and closes, focus moves into the dialog and returns to the opener, Escape closes, clicking the overlay closes (unless disabled by prop), the title is the accessible name.
  • Catalogue entry (with a confirm-style example: icon, message, cancel/confirm buttons).

Acceptance Criteria

  • The component lives in client/src/components/ui/ as a .tsx file, with typed props that pass yarn typecheck (strict mode).
  • Styling uses Tailwind classes only. Variants (if any) are declared with cva, and className is merged with cn() so callers can override.
  • The component does not import anything from @mui/* or @emotion/*.
  • A test file next to the component (for example button.test.tsx) covers: it renders, each variant/size, the disabled and error states where they apply, and keyboard use where it applies (Tab, Enter/Space, Escape, arrow keys). yarn test passes.
  • The component has an entry on the /design-system page: description, props/variants, states, a short do/don't, a code example, and a live demo.
  • Visible focus: there is a clear focus ring when the control is reached by keyboard.
  • The PR does not change any existing screen. Screens adopt the component in their own tickets.

Resources/Instructions

Additional Notes

  • Add an AlertDialog-style confirm helper only if two or more screens need it; otherwise a screen can compose Dialog plus Button.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature: Design systemmilestone: missingrole: Front Endsize: 3pt

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions