Skip to content

fix(alert, toast): run the handler of the pressed cancel button - #31821

Merged
thetaPC merged 3 commits into
mainfrom
FW-7990
Nov 25, 2026
Merged

thetaPC merged 3 commits into
mainfrom
FW-7990

Conversation

@thetaPC

@thetaPC thetaPC commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Issue number: resolves #23037


What is the current behavior?

When an alert or toast has more than one button with role: 'cancel', pressing any of them runs the first cancel button's handler.

What is the new behavior?

  • Pressing a cancel button runs that button's handler.
  • Dismissing without a pressed button still runs the first cancel button's handler. For alert, that's a backdrop tap, Escape or the hardware back button. For toast, it's dismiss() with the cancel role.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Action sheet is not affected: it renders only the first cancel button.

@vercel

vercel Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
ionic-framework Ready Ready Preview Nov 25, 2026 12:08am UTC

Request Review

@github-actions github-actions Bot added the package: core @ionic/core package label Nov 25, 2026
@thetaPC thetaPC changed the title fix(alert): run the handler of the pressed cancel button fix(alert, toast): run the handler of the pressed cancel button Nov 25, 2026

@OS-jacobbell OS-jacobbell left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@thetaPC
thetaPC marked this pull request as ready for review November 25, 2026 23:17
@thetaPC
thetaPC requested a review from a team as a code owner November 25, 2026 23:17
@thetaPC
thetaPC requested a review from ShaneK November 25, 2026 23:17
@thetaPC
thetaPC added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit e890307 Nov 25, 2026
58 checks passed
@thetaPC
thetaPC deleted the FW-7990 branch November 25, 2026 23:31

This branch was successfully deployed

1 active deployment
Preview — de618993 Deployed Nov 25, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: core @ionic/core package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: adding buttons to alert with the same role causes the first handler to always be fired

2 participants