Skip to content

AlertDialog: Cancel button can't be set to tone="neutral", contradicting Button's own tone semantics #81934

Closed

Description

@shaunandrews

Description

Follow-up from #81887 — while I was in there, a reviewer also asked why the Cancel button on our confirm dialog looked blue-tinted next to a red "Delete" button, which reads a little strangely (like there are two competing calls to action). Went looking for a prop to fix it and came up empty, then noticed the reason: it actually goes against how tone is documented to work.

For context, Button's tone prop is documented with a clear semantic:

/**
 * The tone of the button, describing a semantic color intent:
 *
 * - `'brand': for the most prominent actions, using the brand colors.
 * - `'neutral'` for less prominent actions.
 *
 * @default "brand"
 */
tone?: 'brand' | 'neutral';

By that rule, a Cancel button next to a Delete/Confirm button is definitionally "less prominent" and should be tone="neutral". That's exactly what every consumer has to do when composing their own dialog footer with Dialog.Action/Button directly.

AlertDialog.Popup, however, renders its Cancel button internally and hardcodes it:

<_AlertDialog.Close
	render={ <Button variant="minimal" /> }
	disabled={ buttonsDisabled }
>
	{ cancelButtonText }
</_AlertDialog.Close>

No tone is passed, so it falls through to the default ('brand') — contradicting the prop's own documented rule for the exact case the docs describe. PopupProps exposes no prop to override this (only cancelButtonText, a string), so a consumer has no supported way to fix it short of an unlayered CSS override reaching into the component's internals.

This also makes AlertDialog inconsistent with Dialog: the same design system, two ways to build a confirm dialog, and only one of them can follow the tone prop's own stated rule.

Step-by-step reproduction instructions

  1. Render an AlertDialog.Popup with intent="irreversible" (or "default") and any title/confirmButtonText.
  2. Compare its Cancel button to a manually composed <Button variant="minimal" tone="neutral">Cancel</Button> — the styling the docs describe for a "less prominent" action.

Screenshots, screen recording, code snippet

Top row: Button composed directly with tone="neutral" (Cancel) / tone="brand" (Delete) — matches the documented semantic. Bottom: AlertDialog.Popup's own Cancel, which can't be told to do the same:

comparison

Environment info

@wordpress/ui 0.14.0. Confirmed still present on trunk (0.20.0) — PopupProps in packages/ui/src/alert-dialog/types.ts and the hardcoded variant="minimal" in packages/ui/src/alert-dialog/popup.tsx are unchanged.

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested your gutenberg version, plugin version and browser version and can reproduce on the latest of each.

N/A — reproduced against the published @wordpress/ui 0.14.0 package directly, and confirmed against trunk source.

Activity

  1. Kallyan01 commented on Aug 24, 2026

    @Kallyan01

    @shaunandrews I’d be happy to pick this up.

    The fix should be small: update popup.tsx so the Cancel button uses tone="neutral". I don’t think this needs a new public prop.

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

Metadata

Metadata

Labels

[Package] UI/packages/ui[Status] In ProgressTracking issues with work in progress[Type] BugAn existing feature does not function as intended

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    Sponsor
    SponsoredKunjungi sekarang
    Promo