Skip to content

Conversation

haryopba
Copy link

Issue number: resolves #30561


What is the current behavior?

Pressing Enter does not dismiss modal or popover in select-modal or select-popover

What is the new behavior?

  • Pressing Enter dismisses modal or popover in select-modal or select-popover

Does this introduce a breaking change?

  • Yes
  • No

Other information

N/A

@haryopba haryopba requested a review from a team as a code owner August 11, 2025 06:36
@haryopba haryopba requested a review from brandyscarney August 11, 2025 06:36
Copy link

vercel bot commented Aug 11, 2025

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

Project Deployment Preview Comments Updated (UTC)
ionic-framework Ready Ready Preview Comment Aug 25, 2025 5:52am

Copy link
Member

@brandyscarney brandyscarney left a comment

Choose a reason for hiding this comment

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

Thank you for the fix and tests! It looks like this doesn't work to select the value using Enter and there is also an issue where the modal immediately closes when you use Enter to open it after selecting something:

modal.mov

This also happens on the Popover example.

I think we need to add something like this to onKeyDown in radio-group to capture the value:

// Handle Enter key for select interfaces
if (['Enter'].includes(ev.key) && inSelectInterface) {
  const previousValue = this.value;
  this.value = current.value;
  if (previousValue !== this.value) {
    this.emitValueChange(ev);
  }
  ev.preventDefault();
}

But I'm not sure how to fix the other problem right now.

@haryopba
Copy link
Author

@brandyscarney, sorry for the late response. The immediate close happens because the modal opens on keydown with Enter, instead of on keyup like it does with Space. It's a behaviour from ion-item and native button, to fix this I use onKeyDown attribute instead of onKeyUp in select-modal and select-popover.

@haryopba haryopba requested a review from brandyscarney August 25, 2025 06:07
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: Select-Popover does not select the element when enter is pressed
2 participants