fix(select): add Enter keypress to dismiss by haryopba · Pull Request #30622 · ionic-team/ionic-framework

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.