How to focus on save button in alertCtrl after adding input and upon hitting enter


I am working on an Ionic project for desktop/laptop computers (not mobile). I have an AlertController that has an input, a save button, and a cancel button. What I want to happen is that I add input, hit enter, and the input automatically saves. However, when I add input and hit enter, the modal goes away without saving. If I tab to the save button after adding input and hit enter, it saves like it should, so I know the save function is working. I believe this issue is one of focus (please tell me if I’m wrong). How do I set the focus in an alertCtrl so that when I hit enter after adding input it saves the input?

Here is the code for the AlertController:

addTapped(event, cell, rowIndex) {
    const prompt = this.alertCtrl.create({
      title: "Add " + this.selectedItem.label.slice(0, this.selectedItem.label.length-this.selectedItem.trimSingle),
      cssClass: 'buttonCss',
      enableBackdropDismiss: false,
      inputs: [
          name: 'name'
      buttons: [
          text: 'Save',
          handler: data => {
          cssClass: 'buttonColor item-button button button-md button-default button-default-md button-md-pm-yellow'
          text: 'Cancel',
          cssClass: 'item-button button button-md button-outline button-outline-md'

    console.log("You clicked on a detail.");

Here is the code for the save function, in case you need it:

saveNewRow(data) {
    this.selectedItem.service.findOne({order: "id DESC"}).subscribe(result => {
      console.log('The result is ', result);
      this.editRowId =;
      this.editRowData = { id: this.editRowId, name: };
      console.log('editRowData is ', this.editRowData);
      this.selectedItem.service.create(this.editRowData).subscribe(result => {