Skip to content

fix(select): only emit ionChange when value changes#31125

Merged
ShaneK merged 2 commits intomajor-9.0from
FW-6983
May 8, 2026
Merged

fix(select): only emit ionChange when value changes#31125
ShaneK merged 2 commits intomajor-9.0from
FW-6983

Conversation

@ShaneK
Copy link
Copy Markdown
Member

@ShaneK ShaneK commented May 7, 2026

Issue number: internal


What is the current behavior?

In certain circumstances, ion-select emits ionChange every time the overlay is confirmed, even when the user picks the option that was already selected. The popover and modal interfaces don't have this issue because they delegate selection to ion-radio-group / ion-checkbox, which already de-dupe. The mismatch is in select.tsx: the alert OK handler and each action-sheet button handler call setValue() unconditionally, and setValue() always emits.

This contradicts the documented behavior ("Emitted when the value has changed") and is inconsistent with ion-input, ion-textarea, and the other select interfaces.

What is the new behavior?

setValue() now compares the incoming value against the current value and early-returns when they match, so ionChange only fires on an actual change. The comparison honors compareWith for object values and treats multiple arrays as equal when they contain the same elements regardless of order. Behavior across all four interfaces is now consistent.

Does this introduce a breaking change?

  • Yes
  • No

Apps that relied on ionChange firing on every alert/action-sheet confirmation, even without a value change, will need to listen for ionDismiss (or the alert/action-sheet's own dismiss event) instead. This aligns alert/action-sheet with how popover and modal already behave, and with how every other Ionic form control handles ionChange.

Other information

Preview pages (open the alert or action-sheet, click OK or tap the already-selected option, watch the console):

This goes along with the breaking change documentation in ionic docs, here:

@ShaneK ShaneK requested a review from a team as a code owner May 7, 2026 20:46
@ShaneK ShaneK requested a review from BenOsodrac May 7, 2026 20:46
@vercel
Copy link
Copy Markdown

vercel Bot commented May 7, 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 7, 2026 8:46pm

Request Review

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

@ShaneK ShaneK merged commit 071bf3c into major-9.0 May 8, 2026
52 checks passed
@ShaneK ShaneK deleted the FW-6983 branch May 8, 2026 18:44
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.

2 participants