Skip to content

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

Open
ShaneK wants to merge 2 commits intomajor-9.0from
FW-6983
Open

fix(select): only emit ionChange when value changes#31125
ShaneK wants to merge 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

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.

1 participant