Skip to content

Commit ff99204

Browse files
committed
fix(modal): modal incremented breakpoints when scrolling
1 parent bffe460 commit ff99204

File tree

1 file changed

+13
-0
lines changed
  • core/src/components/modal/gestures

1 file changed

+13
-0
lines changed

core/src/components/modal/gestures/sheet.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,19 @@ export const createSheetGesture = (
340340
return Math.abs(b - diff) < Math.abs(a - diff) ? b : a;
341341
});
342342

343+
/**
344+
* If expandToScroll is disabled, we should not allow the moveSheetToBreakpoint
345+
* function to be called if the user is trying to swipe upwards and the content
346+
* is not scrolled to the top.
347+
*/
348+
if (!expandToScroll && detail.deltaY <= 0 && findClosestIonContent(detail.event.target! as HTMLElement)) {
349+
const contentEl = findClosestIonContent(detail.event.target! as HTMLElement)!;
350+
const scrollEl = isIonContent(contentEl) ? getElementRoot(contentEl).querySelector('.inner-scroll') : contentEl;
351+
if (scrollEl!.scrollTop > 0) {
352+
return;
353+
}
354+
}
355+
343356
moveSheetToBreakpoint({
344357
breakpoint: closest,
345358
breakpointOffset: offset,

0 commit comments

Comments
 (0)