Skip to content

feat: ion-datetime: supply modal role on default buttons #28298

Description

@eLyrin

Prerequisites

Describe the Feature Request

The default buttons of ion-datetime close the nearest overlay without supplying a role (=undefined).
When I await the onDidDismiss Promise I can't distinguish between submit and cancel.
see here

As a workaround I would have to supply my own Buttons instead of using the default buttons.

Describe the Use Case

this.modalIonDateTime.present();
const dtResult = await this.modalIonDateTime.onDidDismiss();
// dtResult.role is undefined. Unable to proceed with follow-up logic
<ion-modal [keepContentsMounted]="true">
  <ng-template>
    <ion-datetime formControlName="ionDateTimeCtrl" [presentation]="type"
      [showDefaultButtons]="true" [locale]="(appLanguage.value | async)?.languageCode"
      [cancelText]="'GLOBAL_CANCEL' | translate" [doneText]="'GLOBAL_OK' | translate">
    </ion-datetime>
  </ng-template>
</ion-modal>

Describe Preferred Solution

No response

Describe Alternatives

No response

Related Code

No response

Additional Information

No response

Metadata

Metadata

Assignees

Labels

help wanteda good issue for the community

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions