SIGN IN SIGN UP

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.

0 0 39 TypeScript

fix(select): select focused option on Enter in popover and modal interfaces (#31093)

Issue number: resolves #30561

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

When an `ion-select` with `interface="popover"` or `interface="modal"`
is opened with the keyboard, pressing Enter on a focused option doesn't
commit the value or dismiss the overlay. Only Space works. The `onKeyUp`
handlers in `select-popover.tsx` and `select-modal.tsx` only checked for
`' '`, despite the comment claiming Enter was supported, and
`ion-radio-group`'s arrow-key handler never committed the focused value
on Enter the way native `<select>` does.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

Pressing Enter on a focused option in the popover or modal interface now
commits that option as the select's value and dismisses the overlay,
matching Space and native `<select>` behavior. `radio-group.tsx` gains
an Enter branch inside its select-interface arrow-key handler that sets
`value` to the focused radio and emits `ionChange` when it differs from
the previous value. `select-popover.tsx` and `select-modal.tsx` track
the `onKeyDown` target so `onKeyUp` only dismisses when the Enter press
started on the same option. That guard stops a held Enter on the
triggering `ion-select` from re-firing inside the just-opened overlay
and auto-dismissing it. The `!ev.repeat` check on keydown covers the
same case for the radio-group commit.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

The keydown/keyup target-matching pattern is the same trick the browser
uses to avoid firing a click when keydown and keyup happen on different
elements. It's needed here because Enter on the `ion-select` trigger
opens the overlay on keydown, and without the guard the corresponding
keyup (now inside the overlay) would immediately commit and dismiss.

Preview page:
- [select /
basic](https://ionic-framework-git-fw-6754-ionic1.vercel.app/src/components/select/test/basic?ionic)
S
Shane committed
fd79771e5be77c9f38379a3a7b9ab44bb11ff325
Parent: f3cd39b
Committed by GitHub <noreply@github.com> on 4/29/2026, 1:51:21 PM