Skip to content

🎨 Palette: Replace confirm dialog with AlertDialog#87

Open
Krosebrook wants to merge 1 commit intomainfrom
palette-ux-song-details-alert-dialog-5101894663903765602
Open

🎨 Palette: Replace confirm dialog with AlertDialog#87
Krosebrook wants to merge 1 commit intomainfrom
palette-ux-song-details-alert-dialog-5101894663903765602

Conversation

@Krosebrook
Copy link
Owner

@Krosebrook Krosebrook commented Feb 24, 2026

This change improves the UX of the Song Details page by replacing the native browser confirmation dialog with a custom AlertDialog component. This provides a more integrated and visually consistent experience. Additionally, aria-label attributes were added to icon-only buttons to improve accessibility for screen readers.

Verified with Playwright (mocked backend) and static analysis (pnpm check).


PR created automatically by Jules for task 5101894663903765602 started by @Krosebrook


Summary by cubic

Replaced the native confirm on the Song Details page with the design-system AlertDialog for delete confirmation. Added aria-labels to the Share and Delete icon buttons to improve accessibility.

  • New Features
    • Delete confirmation uses AlertDialog with clear Cancel/Delete actions and contextual copy.
    • Added aria-labels ("Share song", "Delete song") for screen readers.

Written for commit 59fd886. Summary will update on new commits.

- Replaced `window.confirm` with `@/components/ui/alert-dialog` for song deletion confirmation.
- Added `aria-label` to the delete button ("Delete song") and share button ("Share song").
- Improved accessibility and visual consistency with the design system.

Co-authored-by: Krosebrook <214532761+Krosebrook@users.noreply.github.com>
@google-labs-jules
Copy link
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI review requested due to automatic review settings February 24, 2026 06:08
@coderabbitai
Copy link

coderabbitai bot commented Feb 24, 2026

Warning

Rate limit exceeded

@Krosebrook has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 3 minutes and 24 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 9060759 and 59fd886.

📒 Files selected for processing (1)
  • client/src/pages/SongDetails.tsx
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch palette-ux-song-details-alert-dialog-5101894663903765602

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.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Krosebrook, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves the user experience and accessibility on the Song Details page. It transitions from using a generic browser confirmation prompt to a custom AlertDialog for critical actions like song deletion, offering a consistent visual style. Additionally, it boosts accessibility for users relying on screen readers by ensuring that icon-only buttons now have descriptive aria-label attributes.

Highlights

  • Custom Confirmation Dialog: Replaced the native browser confirm() dialog with a custom AlertDialog component for the song deletion action, providing a more integrated UI experience.
  • Accessibility Improvements: Enhanced accessibility by adding aria-label attributes to icon-only buttons (Share and Delete) for better screen reader support.
Changelog
  • client/src/pages/SongDetails.tsx
    • Imported AlertDialog and related components from @/components/ui/alert-dialog.
    • Removed the window.confirm call from the handleDelete function.
    • Added aria-label="Share song" to the Share button.
    • Wrapped the Delete button within an AlertDialogTrigger and implemented the full AlertDialogContent for song deletion confirmation, including title, description, and action buttons.
Activity
  • PR created automatically by Jules for task 5101894663903765602, started by Krosebrook.
  • Changes verified with Playwright (mocked backend) and static analysis (pnpm check).
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 1 file

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="client/src/pages/SongDetails.tsx">

<violation number="1" location="client/src/pages/SongDetails.tsx:210">
P2: Disable the AlertDialog delete action while the delete mutation is pending to prevent duplicate delete requests from rapid double-clicks.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction onClick={handleDelete} className="bg-destructive text-destructive-foreground hover:bg-destructive/90">Delete</AlertDialogAction>
Copy link

@cubic-dev-ai cubic-dev-ai bot Feb 24, 2026

Choose a reason for hiding this comment

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

P2: Disable the AlertDialog delete action while the delete mutation is pending to prevent duplicate delete requests from rapid double-clicks.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At client/src/pages/SongDetails.tsx, line 210:

<comment>Disable the AlertDialog delete action while the delete mutation is pending to prevent duplicate delete requests from rapid double-clicks.</comment>

<file context>
@@ -174,16 +184,33 @@ export default function SongDetails() {
+                    </AlertDialogHeader>
+                    <AlertDialogFooter>
+                      <AlertDialogCancel>Cancel</AlertDialogCancel>
+                      <AlertDialogAction onClick={handleDelete} className="bg-destructive text-destructive-foreground hover:bg-destructive/90">Delete</AlertDialogAction>
+                    </AlertDialogFooter>
+                  </AlertDialogContent>
</file context>
Suggested change
<AlertDialogAction onClick={handleDelete} className="bg-destructive text-destructive-foreground hover:bg-destructive/90">Delete</AlertDialogAction>
<AlertDialogAction onClick={handleDelete} disabled={isDeleting} className="bg-destructive text-destructive-foreground hover:bg-destructive/90">Delete</AlertDialogAction>
Fix with Cubic

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Song Details page UX by replacing the native browser confirm() delete prompt with the app’s Radix/shadcn AlertDialog, and adds accessibility labels to icon-only actions.

Changes:

  • Replaced the delete confirmation confirm() flow with an AlertDialog confirmation modal.
  • Added aria-label to the Share icon button (and to the Delete icon button in the new dialog trigger).
Comments suppressed due to low confidence (1)

client/src/pages/SongDetails.tsx:165

  • This icon-only button now has an aria-label, but the decorative icon should be marked aria-hidden="true" to avoid screen readers announcing both the label and the icon glyph/name.
                      aria-label="Share song"
                      data-testid="button-share"
                    >
                      <Share2 className="w-4 h-4 md:w-5 md:h-5" />
                    </Button>

Comment on lines +209 to +210
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction onClick={handleDelete} className="bg-destructive text-destructive-foreground hover:bg-destructive/90">Delete</AlertDialogAction>
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

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

AlertDialogAction remains clickable while the delete mutation is pending. Since handleDelete doesn’t guard against repeated calls, users can trigger multiple delete requests by clicking "Delete" multiple times after the dialog opens. Disable the action (and optionally cancel) while isDeleting is true, and/or add a guard in handleDelete to no-op when already pending.

Suggested change
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction onClick={handleDelete} className="bg-destructive text-destructive-foreground hover:bg-destructive/90">Delete</AlertDialogAction>
<AlertDialogCancel disabled={isDeleting}>Cancel</AlertDialogCancel>
<AlertDialogAction
onClick={isDeleting ? undefined : handleDelete}
disabled={isDeleting}
className="bg-destructive text-destructive-foreground hover:bg-destructive/90"
>
{isDeleting ? "Deleting..." : "Delete"}
</AlertDialogAction>

Copilot uses AI. Check for mistakes.
aria-label="Delete song"
data-testid="button-delete-song"
>
<Trash2 className="w-4 h-4 md:w-5 md:h-5" />
Copy link

Copilot AI Feb 24, 2026

Choose a reason for hiding this comment

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

This icon-only destructive button has an aria-label, but the Trash2 icon should be aria-hidden="true" so assistive tech doesn’t announce the icon in addition to the button label.

Suggested change
<Trash2 className="w-4 h-4 md:w-5 md:h-5" />
<Trash2 className="w-4 h-4 md:w-5 md:h-5" aria-hidden="true" />

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request successfully replaces the native browser confirmation dialog with a custom AlertDialog component, improving the user experience and visual consistency. Additionally, aria-label attributes have been added to icon-only buttons, which is a good step towards improving accessibility. The changes are well-implemented and align with modern web development practices.

I am having trouble creating individual review comments. Click here to see my feedback.

client/src/pages/SongDetails.tsx (44-50)

high

The if (confirm("Are you sure? This cannot be undone.")) block has been removed, which is correct given the introduction of the AlertDialog. However, it's important to ensure that the handleDelete function is only called when the user explicitly confirms the deletion in the new AlertDialog to prevent accidental deletions.

client/src/pages/SongDetails.tsx (161)

medium

Adding aria-label="Share song" is a good practice for accessibility, especially for icon-only buttons. This helps screen readers convey the purpose of the button to users.

client/src/pages/SongDetails.tsx (195)

medium

The aria-label="Delete song" attribute is correctly added to the delete button, enhancing accessibility for screen reader users by providing a clear description of the button's action.

client/src/pages/SongDetails.tsx (205)

medium

The AlertDialogDescription correctly uses song.title to provide a more specific and user-friendly confirmation message. This improves the user experience by clearly stating which song will be deleted.

client/src/pages/SongDetails.tsx (210)

medium

The AlertDialogAction for deletion correctly calls handleDelete when confirmed. The styling className="bg-destructive text-destructive-foreground hover:bg-destructive/90" also visually reinforces the destructive nature of the action, which is good for UX.

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