feat(menu): pass role to ionWillClose and ionDidClose events (#29954)

- Adds the `MenuCloseEventDetail` interface which includes an optional `role` property
- The `ionWillClose` and `ionDidClose` emit the `role` property for the following scenarios:
  - A role of `'gesture'` when dragging the menu closed
- A role of `'backdrop'` when clicking on the backdrop to close the menu
- A role of `'backdrop'` when the the menu is closed using the escape key
- A role of `undefined` when the menu is closed from a button inside of
the menu
This commit is contained in:
Brandy Carney
2024-10-22 10:55:45 -04:00
committed by Tanner Reits
parent 2d6eeee267
commit ee2fa19a1e
10 changed files with 163 additions and 42 deletions

View File

@ -1334,6 +1334,8 @@ export class IonMenu {
}
import type { MenuCloseEventDetail as IIonMenuMenuCloseEventDetail } from '@ionic/core';
export declare interface IonMenu extends Components.IonMenu {
/**
* Emitted when the menu is about to be opened.
@ -1342,7 +1344,7 @@ export declare interface IonMenu extends Components.IonMenu {
/**
* Emitted when the menu is about to be closed.
*/
ionWillClose: EventEmitter<CustomEvent<void>>;
ionWillClose: EventEmitter<CustomEvent<IIonMenuMenuCloseEventDetail>>;
/**
* Emitted when the menu is open.
*/
@ -1350,7 +1352,7 @@ export declare interface IonMenu extends Components.IonMenu {
/**
* Emitted when the menu is closed.
*/
ionDidClose: EventEmitter<CustomEvent<void>>;
ionDidClose: EventEmitter<CustomEvent<IIonMenuMenuCloseEventDetail>>;
}