Skip to content

Commit

Permalink
fix(datetime): swipe gesture threshold on desktop browsers
Browse files Browse the repository at this point in the history
Resolves #24482
  • Loading branch information
sean-perkins committed Jan 31, 2022
1 parent 4434299 commit 16d46c8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions core/src/components/datetime/datetime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,12 @@ export class Datetime implements ComponentInterface {
});
}

const threshold = mode === 'ios' &&
// tslint:disable-next-line
typeof navigator !== 'undefined' &&
navigator.maxTouchPoints > 1 ?
[0.7, 1] : 1;

/**
* Listen on the first month to
* prepend a new month and on the last
Expand All @@ -811,13 +817,13 @@ export class Datetime implements ComponentInterface {
* something WebKit does.
*/
endIO = new IntersectionObserver(ev => ioCallback('end', ev), {
threshold: mode === 'ios' ? [0.7, 1] : 1,
threshold,
root: calendarBodyRef
});
endIO.observe(endMonth);

startIO = new IntersectionObserver(ev => ioCallback('start', ev), {
threshold: mode === 'ios' ? [0.7, 1] : 1,
threshold,
root: calendarBodyRef
});
startIO.observe(startMonth);
Expand Down

0 comments on commit 16d46c8

Please sign in to comment.