feat(modal): add drag events for sheet and card modals (#30962)

Issue number: internal

---------

## What is the current behavior?
The sheet and card modal can be dragged to view content. However, there
are no events that determine when drag has started or ended.

## What is the new behavior?
- Added drag events for sheet and card modal: `ionDragStart`, `ionDragMove`, `ionDragEnd`
- Added a drag interface
- Added tests

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

---------

Co-authored-by: Shane <shane@shanessite.net>
Co-authored-by: Brandy Smith <brandyscarney@users.noreply.github.com>
This commit is contained in:
Maria Hutt
2026-03-04 11:53:50 -08:00
committed by GitHub
parent 5bcf921841
commit d29ac713fa
29 changed files with 505 additions and 51 deletions

View File

@@ -7,7 +7,7 @@ import {
NgZone,
TemplateRef,
} from '@angular/core';
import type { Components, ModalBreakpointChangeEventDetail } from '@ionic/core/components';
import type { Components, ModalBreakpointChangeEventDetail, ModalDragEventDetail } from '@ionic/core/components';
import { ProxyCmp, proxyOutputs } from '../utils/proxy';
@@ -32,6 +32,18 @@ export declare interface IonModal extends Components.IonModal {
* Emitted after the modal breakpoint has changed.
*/
ionBreakpointDidChange: EventEmitter<CustomEvent<ModalBreakpointChangeEventDetail>>;
/**
* Emitted when the sheet or card modal has started being dragged.
*/
ionDragStart: EventEmitter<void>;
/**
* Emitted while the sheet or card modal is being dragged.
*/
ionDragMove: EventEmitter<CustomEvent<ModalDragEventDetail>>;
/**
* Emitted when the sheet or card modal has finished being dragged.
*/
ionDragEnd: EventEmitter<CustomEvent<ModalDragEventDetail>>;
/**
* Emitted after the modal has presented. Shorthand for ionModalDidPresent.
*/
@@ -130,6 +142,9 @@ export class IonModal {
'willPresent',
'willDismiss',
'didDismiss',
'ionDragStart',
'ionDragMove',
'ionDragEnd',
]);
}
}