fix(datetime): swiping wheel no longer dismisses card modal (#25981)

This commit is contained in:
Liam DeBeasi
2022-09-21 14:28:35 -05:00
committed by GitHub
parent 21dc893f90
commit 7543c84445

View File

@ -1,5 +1,5 @@
import type { ComponentInterface, EventEmitter } from '@stencil/core';
import { Component, Element, Event, Host, h } from '@stencil/core';
import { Component, Element, Event, Listen, Host, h } from '@stencil/core';
import { getElementRoot } from '../../utils/helpers';
@ -30,6 +30,19 @@ export class PickerInternal implements ComponentInterface {
@Event() ionInputModeChange!: EventEmitter<PickerInternalChangeEventDetail>;
/**
* When the picker is interacted with
* we need to prevent touchstart so other
* gestures do not fire. For example,
* scrolling on the wheel picker
* in ion-datetime should not cause
* a card modal to swipe to close.
*/
@Listen('touchstart')
preventTouchStartPropagation(ev: TouchEvent) {
ev.stopPropagation();
}
componentWillLoad() {
getElementRoot(this.el).addEventListener('focusin', this.onFocusIn);
getElementRoot(this.el).addEventListener('focusout', this.onFocusOut);