Skip to content

fix: alert dialog styles and remove built-in close button#813

Merged
rohanchkrabrty merged 2 commits into
mainfrom
fix-alert-dialog
May 19, 2026
Merged

fix: alert dialog styles and remove built-in close button#813
rohanchkrabrty merged 2 commits into
mainfrom
fix-alert-dialog

Conversation

@rohanchkrabrty
Copy link
Copy Markdown
Contributor

Summary

  • Reworked AlertDialog spacing: header gets space-7 on all sides (collapses to space-5 bottom when followed by a body); body is 0 / space-7 / space-5 (or space-7 all sides when no header precedes it); removed header/footer borders.
  • AlertDialog.Header is now direction='column' with gap={3} so Title + Description stack naturally inside it; docs example updated to use the header (no Body wrapper).
  • Dropped the built-in close button from AlertDialog: removed the showCloseButton prop, the internal CloseButton, and the corresponding AlertDialogCloseButtonProps/docs section. Updated examples and tests accordingly.
  • Cleaned up hardcoded widths from AlertDialog docs examples.
  • Dialog tweaks: close button now renders via IconButton, default content width pinned to 400px, body padding bumped to space-9 / space-7.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

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

Project Deployment Actions Updated (UTC)
apsara Ready Ready Preview, Comment May 19, 2026 5:40am

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 19, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR removes the explicit showCloseButton control from AlertDialog, simplifies the component API, and refactors related dialog styling. The showCloseButton prop and CloseButton component export are removed from AlertDialog, with close functionality handled only via AlertDialog.Close. AlertDialogHeader and AlertDialogBody are restructured to use CSS layout classes for consistent spacing and padding. The Dialog component's close button is refactored to render an IconButton via a render prop instead of directly applying CSS classes. Dialog content receives a fixed 400px width, and styling adjustments are made to close button positioning and body padding.

Suggested reviewers

  • rsbh
  • paanSinghCoder
  • rohilsurana
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: fixing AlertDialog styles and removing the built-in close button, which are the core objectives of the changeset.
Description check ✅ Passed The description is directly related to the changeset, providing detailed explanations of AlertDialog spacing rework, Header layout changes, close button removal, and Dialog tweaks.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
packages/raystack/components/alert-dialog/__tests__/alert-dialog.test.tsx (1)

93-123: ⚡ Quick win

Add a regression test for removed built-in close button.

Please add an assertion that the default "Close dialog" button is not rendered after opening, so the API-removal contract is locked in by tests.

Proposed test addition
 describe('Close Behavior', () => {
+  it('does not render a built-in close button', async () => {
+    renderAndOpenAlertDialog(<BasicAlertDialog />);
+
+    await waitFor(() => {
+      expect(screen.getByRole('alertdialog')).toBeInTheDocument();
+    });
+
+    expect(
+      screen.queryByRole('button', { name: /close dialog/i })
+    ).not.toBeInTheDocument();
+  });
+
   it('closes when AlertDialog.Close is clicked', async () => {
     renderAndOpenAlertDialog(<BasicAlertDialog />);
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/raystack/components/alert-dialog/__tests__/alert-dialog.test.tsx`
around lines 93 - 123, Add an assertion to the Close Behavior tests to verify
the removed built-in close button is not present: after calling
renderAndOpenAlertDialog(<BasicAlertDialog />) and confirming the alertdialog
appears (using screen.getByRole('alertdialog')), assert that a button with
accessible name "Close dialog" is not in the document (e.g.,
expect(screen.queryByRole('button', { name: /Close dialog/i })).toBeNull() or
similar). Place this check in the same 'closes when AlertDialog.Close is
clicked' or 'does not close on outside click' test blocks (or a new test) to
lock the API-removal contract; reference the existing helpers and symbols
renderAndOpenAlertDialog, BasicAlertDialog, ALERT_CLOSE and styles.dialogOverlay
when locating where to add the assertion.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/raystack/components/alert-dialog/__tests__/alert-dialog.test.tsx`:
- Around line 93-123: Add an assertion to the Close Behavior tests to verify the
removed built-in close button is not present: after calling
renderAndOpenAlertDialog(<BasicAlertDialog />) and confirming the alertdialog
appears (using screen.getByRole('alertdialog')), assert that a button with
accessible name "Close dialog" is not in the document (e.g.,
expect(screen.queryByRole('button', { name: /Close dialog/i })).toBeNull() or
similar). Place this check in the same 'closes when AlertDialog.Close is
clicked' or 'does not close on outside click' test blocks (or a new test) to
lock the API-removal contract; reference the existing helpers and symbols
renderAndOpenAlertDialog, BasicAlertDialog, ALERT_CLOSE and styles.dialogOverlay
when locating where to add the assertion.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e31c553e-4861-47aa-aede-cda64afbd79d

📥 Commits

Reviewing files that changed from the base of the PR and between 5b27e53 and 37c2225.

📒 Files selected for processing (11)
  • apps/www/src/components/playground/alert-dialog-examples.tsx
  • apps/www/src/content/docs/components/alert-dialog/demo.ts
  • apps/www/src/content/docs/components/alert-dialog/index.mdx
  • apps/www/src/content/docs/components/alert-dialog/props.ts
  • packages/raystack/components/alert-dialog/__tests__/alert-dialog.test.tsx
  • packages/raystack/components/alert-dialog/alert-dialog-content.tsx
  • packages/raystack/components/alert-dialog/alert-dialog-misc.tsx
  • packages/raystack/components/alert-dialog/alert-dialog.module.css
  • packages/raystack/components/alert-dialog/alert-dialog.tsx
  • packages/raystack/components/dialog/dialog-misc.tsx
  • packages/raystack/components/dialog/dialog.module.css
💤 Files with no reviewable changes (2)
  • apps/www/src/content/docs/components/alert-dialog/props.ts
  • packages/raystack/components/alert-dialog/alert-dialog-content.tsx

@rohanchkrabrty rohanchkrabrty merged commit b99d0f5 into main May 19, 2026
5 checks passed
@rohanchkrabrty rohanchkrabrty deleted the fix-alert-dialog branch May 19, 2026 06:03
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.

2 participants