Repository: ionic-team/ionic-framework
File: core/src/components/modal/gestures/sheet.ts (TypeScript)

Code before:
    /**
     * Gesture should remain disabled until the
     * snapping animation completes.
     */
    gesture.enable(false);

    if (shouldPreventDismiss) {
      handleCanDismiss(baseEl, animation);
    } else if (!shouldRemainOpen) {
      onDismiss();
    }

    /**
     * Enables scrolling immediately if the sheet is about to fully expand
     * or if it allows scrolling at any breakpoint. Without this, there would
     * be a ~500ms delay while the modal animation completes, causing a
     * noticeable lag. Native iOS allows scrolling as soon as the gesture is
     * released, so we align with that behavior.
     */
    if (contentEl && (snapToBreakpoint === breakpoints[breakpoints.length - 1] || !expandToScroll)) {
      contentEl.scrollY = true;
    }

    /**
     * If expandToScroll is disabled and we're animating
     * to the close of the sheet, we need to swap
     * the footer position to stationary so that it
     * will collapse correctly. We cannot just always swap
     * here or it'll be jittery while animating movement.
     */
    if (!expandToScroll && snapToBreakpoint === 0) {
      swapFooterPosition('stationary');
    }

    return new Promise<void>((resolve) => {
      animation
        .onFinish(
          () => {
            if (shouldRemainOpen) {
              /**
               * If expandToScroll is disabled, we need to swap
               * the footer position to stationary so that it
               * will act as it would by default
               */
              if (!expandToScroll) {
                swapFooterPosition('stationary');
              }

              /**
               * Once the snapping animation completes,
               * we need to reset the animation to go

Review comment (suggestion):
```suggestion
     * to close the sheet, we need to swap
```

Code after:
    /**
     * Gesture should remain disabled until the
     * snapping animation completes.
     */
    gesture.enable(false);

    if (shouldPreventDismiss) {
      handleCanDismiss(baseEl, animation);
    } else if (!shouldRemainOpen) {
      onDismiss();
    }

    /**
     * Enables scrolling immediately if the sheet is about to fully expand
     * or if it allows scrolling at any breakpoint. Without this, there would
     * be a ~500ms delay while the modal animation completes, causing a
     * noticeable lag. Native iOS allows scrolling as soon as the gesture is
     * released, so we align with that behavior.
     */
    if (contentEl && (snapToBreakpoint === breakpoints[breakpoints.length - 1] || !expandToScroll)) {
      contentEl.scrollY = true;
    }

    /**
     * If expandToScroll is disabled and we're animating
     * to close the sheet, we need to swap
     * the footer position to stationary so that it
     * will collapse correctly. We cannot just always swap
     * here or it'll be jittery while animating movement.
     */
    if (!expandToScroll && snapToBreakpoint === 0) {
      swapFooterPosition('stationary');
    }

    return new Promise<void>((resolve) => {
      animation
        .onFinish(
          () => {
            if (shouldRemainOpen) {
              /**
               * If expandToScroll is disabled, we need to swap
               * the footer position to stationary so that it
               * will act as it would by default.
               */
              if (!expandToScroll) {
                swapFooterPosition('stationary');
              }

              /**
               * Once the snapping animation completes,
               * we need to reset the animation to go