Modal dismiss not firing on escape key


#1

I open a Modal and hit the escape key ( in browser ).
dismiss() is not called and no data is returned to the onDidDismiss function. It is called but with no data.
Example below:

let profileModal = this.modalCtrl.create(ModalPage, { time: 30 });
      
      profileModal.onDidDismiss(data => {
        console.log('modal data sent to main form', data)
      });
   profileModal.present();

ModalPage:

dismiss(){
    console.log("Modal Page Dismiss")
    let data = { 'time': '60' };
    this.viewCtrl.dismiss(data);
  }

I can however pass the data from the modal to the onDidDismiss by using:

ionViewWillLeave(){
    console.log("ON MODAL ionViewDidLeave")
    let data = { 'time': 60 };
    this.viewCtrl.dismiss(data);
  }

But I get this error:
ERROR Error: Uncaught (in promise): removeView was not found
because it is trying to dismiss a Modal that was alraedy dismissed by the Escape key.

If I add a button to the Modal and call this:

let data = { 'time': 60 };
this.viewCtrl.dismiss(data);

It works fine. This is strictly about catching the Escape dismiss and apssing data back to onDidDismiss()