Skip to content

fix(alert): switch to vertical layout when two buttons wrap#31130

Merged
ShaneK merged 3 commits intomainfrom
FW-7244
May 8, 2026
Merged

fix(alert): switch to vertical layout when two buttons wrap#31130
ShaneK merged 3 commits intomainfrom
FW-7244

Conversation

@ShaneK
Copy link
Copy Markdown
Member

@ShaneK ShaneK commented May 8, 2026

Issue number: internal


What is the current behavior?

When an ion-alert has two buttons whose combined text is too long to fit on one row, flex-wrap pushes the second button onto a new row. The horizontal layout's right border (drawn between buttons via alert.ios.scss) stays on the first button, leaving a stray vertical separator at the wrap edge. The alert-button-group-vertical class only triggers on buttons.length > 2, so two-button alerts can't opt into the clean vertical layout even when they visually need it.

What is the new behavior?

The alert now watches its button group with a ResizeObserver and toggles alert-button-group-vertical whenever the buttons render at different offsetTop values, so wrapping two-button alerts get the same vertical treatment as three-or-more-button alerts. The wrap state resets when the buttons prop changes so a new button set is re-evaluated from scratch, and the observer is re-attached in connectedCallback so reconnected alerts keep working. The layout read is deferred via raf to avoid forcing synchronous layout and to sidestep ResizeObserver loop warnings.

Does this introduce a breaking change?

  • Yes
  • No

Other information

The right-border styling between buttons only exists in iOS mode, so the new e2e test is iOS only

Preview:

A lot of the updated screenshots are because of the new alert button. We should probably make note of these to go back and update the tests so they focus on the modal and don't include the background to prevent this sort of update spam in the future.

@ShaneK ShaneK requested a review from a team as a code owner May 8, 2026 20:25
@ShaneK ShaneK requested a review from gnbm May 8, 2026 20:25
@vercel
Copy link
Copy Markdown

vercel Bot commented May 8, 2026

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

Project Deployment Actions Updated (UTC)
ionic-framework Ready Ready Preview, Comment May 8, 2026 10:13pm

Request Review

@github-actions github-actions Bot added the package: core @ionic/core package label May 8, 2026
Copy link
Copy Markdown
Contributor

@thetaPC thetaPC left a comment

Choose a reason for hiding this comment

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

LGTM, with a nit

Comment thread core/src/components/alert/test/basic/alert.e2e.ts Outdated
Co-authored-by: Maria Hutt <thetaPC@users.noreply.github.com>
@ShaneK ShaneK added this pull request to the merge queue May 8, 2026
Merged via the queue into main with commit 07675f9 May 8, 2026
51 checks passed
@ShaneK ShaneK deleted the FW-7244 branch May 8, 2026 22:50
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.

3 participants